<template>
    <section>
        <el-row>
            <el-tag class="el-icon-sold-out">&nbsp;借出数量：<span style="font-size: 13px;font-weight: bold">{{lendNum}}</span></el-tag>&nbsp;
            <el-tag class="el-icon-sell" type="success">&nbsp;归还数量：<span style="font-size: 13px;font-weight: bold">{{returnNum}}</span></el-tag>&nbsp;
            <el-tag class="el-icon-sold-out" type="warning">&nbsp;赠送数量：<span style="font-size: 13px;font-weight: bold">{{giveNum}}</span></el-tag>&nbsp;
            <el-tag class="el-icon-sold-out" type="danger" v-if="unReturnNum>0">
                &nbsp;您还有&nbsp;<span style="font-size: 13px;font-weight: bold">{{unReturnNum}}</span>
                条借出单据未归还
            </el-tag>
        </el-row>
        <el-col :span="24">
            <el-form inline>
                <el-form-item>
                    <el-input size="small" v-model.trim="form.allocation_number" placeholder="单号, 多个请用“逗号”隔开" style="width: 250px;" clearable></el-input>
                </el-form-item>
                <el-form-item>
                    <el-select v-model="form.groups" placeholder="调拨类型" size="small" style="width: 125px" multiple collapse-tags clearable>
                        <el-option :value=1 label="赠送"></el-option>
                        <el-option :value=2 label="借出"></el-option>
                        <el-option :value=3 label="归还"></el-option>
                        <el-option :value=4 label="销售"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item>
                    <el-select v-model="form.status" placeholder="审批状态" size="small" style="width: 135px" multiple collapse-tags clearable>
                        <el-option :value=-1 label="未发起"></el-option>
                        <el-option :value=0 label="审核中"></el-option>
                        <el-option :value=1 label="已通过"></el-option>
                        <el-option :value=2 label="已拒绝"></el-option>
                        <el-option :value=3 label="已撤回"></el-option>
                        <el-option :value=4 label="已撤销"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item>
                    <el-select v-model="form.data_return" placeholder="归还状态" size="small" style="width: 150px" multiple collapse-tags clearable>
                        <el-option :value=0 label="未归还"></el-option>
                        <el-option :value=1 label="部分归还"></el-option>
                        <el-option :value=2 label="全部归还"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item>
                    <el-popover placement="bottom" width="450" trigger="click">
                        <el-form label-width="80px" label-position="left">
                            <el-form-item label="推送状态">
                                <el-select v-model="form.is_push" placeholder="推送状态" size="small" style="width: 80%" clearable>
                                    <el-option :value=0 label="未推送"></el-option>
                                    <el-option :value=1 label="已推送"></el-option>
                                    <el-option :value=2 label="推送失败"></el-option>
                                </el-select>
                            </el-form-item>
                            <el-form-item label="单据状态">
                                <el-select v-model="form.data_status" placeholder="是否正常" size="small" style="width: 80%" clearable>
                                    <el-option :value=0 label="正常"></el-option>
                                    <el-option :value=1 label="已关闭"></el-option>
                                </el-select>
                            </el-form-item>
                            <el-form-item label="前交接人">
                                <el-input size="small" v-model.trim="form.from_adduser" placeholder="前一个工作交接人" style="width: 80%;" clearable></el-input>
                            </el-form-item>
                            <el-form-item label="申请事由">
                                <el-input size="small" v-model.trim="form.reason" placeholder="申请事由" style="width: 80%;" clearable></el-input>
                            </el-form-item>
                            <el-form-item label="详细地址">
                                <el-input size="small" v-model.trim="form.wp_address" placeholder="请输入相关地址关键词" style="width: 80%;" clearable></el-input>
                            </el-form-item>
                            <el-form-item label="联系电话">
                                <el-input size="small" v-model.trim="form.wp_phone" placeholder="联系电话（收件人）" style="width: 80%;" clearable></el-input>
                            </el-form-item>
                            <el-form-item label="联系人">
                                <el-input size="small" v-model.trim="form.wp_user" placeholder="联系人（收件人）" style="width: 80%;" clearable></el-input>
                            </el-form-item>
                            <el-form-item label="发起时间">
                                <el-date-picker value-format="yyyy-MM-dd" v-model="form.createtime" type="daterange" size="small" style="width: 80%"
                                                range-separator="~" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
                            </el-form-item>
                            <el-form-item label="品牌类型">
                                <el-select size="small" v-model="form.is_subject" placeholder="品牌类型" style="width: 80%" clearable>
                                    <el-option value="kz" label="十三余"></el-option>
                                    <el-option value="mz" label="十三余(童装)"></el-option>
                                    <el-option value="yx" label="有香"></el-option>
                                    <el-option value="xm" label="一弦一木"></el-option>
                                    <el-option value="js" label="锦瑟"></el-option>
                                    <el-option value="qyx" label="七月夕"></el-option>
                                </el-select>
                            </el-form-item>
                            <el-form-item label="物料编码">
                                <el-input size="small" v-model.trim="form.sku_code" placeholder="请输入sku, 多个请用“逗号”隔开" style="width: 80%;" clearable></el-input>
                            </el-form-item>
                        </el-form>
                        <el-badge :is-dot="(form.is_push!=='' || form.data_status!=='' || !!form.from_adduser || !!form.reason || !!form.reason
                        || !!form.remark || !!form.wp_address || !!form.wp_phone || !!form.wp_user || !!form.createtime || !!form.is_subject || !!form.sku_code)"
                                  slot="reference" class="more-btn">
                            <el-button size="small" type="warning" plain>更多</el-button>
                        </el-badge>
                    </el-popover>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" class="el-icon-search" @click="searchBtn" size="small" :loading="btnLoading">查询</el-button>
                </el-form-item>
                <el-form-item style="float: right">
                    <el-button size="small" class="el-icon-sold-out" type="primary" @click="lendVisible=true" plain>&nbsp;我要借出</el-button>
                    <el-button size="small" class="el-icon-sold-out" type="warning" @click="giveVisible=true" plain>&nbsp;我要赠送</el-button>
                    <el-button size="small" class="el-icon-sold-out" type="sale" @click="saleVisible=true" plain>&nbsp;我要销售</el-button>
                </el-form-item>
            </el-form>
        </el-col>
        <el-col :span="24">
            <el-table :data="data" style="width: 100%" :max-height="tableHeight" v-loading="loading" size="mini" :row-class-name="rowClassName">
                <el-table-column type="expand">
                    <template slot-scope="{row}">
                        <el-form label-position="left" class="demo-table-expand" size="mini">
                            <el-form-item label="申请事由：">{{row.reason}}</el-form-item>
                            <el-form-item label="备注信息：">{{row.remark}}</el-form-item>
                            <el-form-item label="快递单号：">{{ row.courier_number || row.ourier_number }}</el-form-item>
                            <el-form-item label="发货时间：">{{ row.date || "立即发货" }}</el-form-item>
                            <el-form-item label="收件信息：">
                                <div v-if="row.wp_user && row.wp_phone && row.wp_address">
                                    {{ row.wp_user + "，" }} {{ row.wp_phone + "，"
                                    }}{{ row.wp_province }}{{ row.wp_city }}{{ row.wp_area
                                    }}{{ row.wp_address }}
                                </div>
                            </el-form-item>
                            <el-form-item label="sku编码：">
                                <template v-for="(sku_code, index) in row.sku_codes">
                                    <el-tag size="mini">{{sku_code}}</el-tag>&nbsp;
                                </template>
                            </el-form-item>
                        </el-form>
                    </template>
                </el-table-column>
                <el-table-column prop="allocation_number" label="单号" width="170">
                    <template slot-scope="{row}">
                        <a v-if="row.source_allocation_number" @click="searchAllocationBtn(row.source_allocation_number, row.allocation_number)">{{row.allocation_number}}</a>
                        <template v-else>
                            <a v-if="row.allocation_in_numbers.length>0" @click="searchAllocationBtn(row.allocation_in_numbers, row.allocation_number)">{{row.allocation_number}}</a>
                            <span v-else>{{row.allocation_number}}</span>
                        </template>
                    </template>
                </el-table-column>
                <el-table-column prop="approval_id" label="审批id" show-overflow-tooltip></el-table-column>
                <el-table-column prop="groups" label="类型">
                    <template slot-scope="{ row }">
                        <el-tag v-if="row.groups==1" type="warning" size="mini">赠送</el-tag>
                        <el-tag v-else-if="row.groups==2" size="mini">借出</el-tag>
                        <el-tag v-else-if="row.groups==3" type="success" size="mini">归还</el-tag>
                        <el-tag v-else-if="row.groups==4" type="sale" size="mini">销售</el-tag>
                        <span v-else>{{row.groups}}</span>
                    </template>
                </el-table-column>
                <el-table-column prop="adduser" label="发起人" width="80"></el-table-column>
                <el-table-column prop="createtime" label="发起时间" width="135"></el-table-column>
                <el-table-column prop="plan_num" label="计划/实际数量" width="100">
                    <template slot-scope="{ row }">
                        <div style="font-size: 14px;font-weight: bold">
                            <span>{{ row.plan_num || 0 }} / </span>
                            <span style="color: red">{{ row.actually_num || 0 }}</span>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column prop="actually_return_num" label="归还数量">
                    <template slot-scope="{ row }">
                        <div style="font-size: 14px;font-weight: bold" :style="{color: row.actually_return_num ? '':'#dcdfe6'}">{{ row.actually_return_num}}</div>
                    </template>
                </el-table-column>
                <el-table-column prop="ipurchase_num" label="转内购数">
                    <template slot-scope="{ row }">
                        <div style="font-size: 14px;font-weight: bold" :style="{color: row.ipurchase_num ? '':'#dcdfe6'}">{{ row.ipurchase_num}}</div>
                    </template>
                </el-table-column>
                <el-table-column prop="give_num" label="转赠送数">
                    <template slot-scope="{ row }">
                        <div style="font-size: 14px;font-weight: bold" :style="{color: row.give_num ? '':'#dcdfe6'}">{{ row.give_num}}</div>
                    </template>
                </el-table-column>
                <el-table-column prop="sale_num" label="转销售数">
                    <template slot-scope="{ row }">
                        <div style="font-size: 14px;font-weight: bold" :style="{color: row.sale_num ? '':'#dcdfe6'}">{{ row.sale_num}}</div>
                    </template>
                </el-table-column>
                <el-table-column prop="date" label="计划发货日期" width="95">
                    <template slot-scope="{ row }">
                        {{ row.date || "立即发货" }}
                    </template>
                </el-table-column>
                <el-table-column prop="courier_number" label="快递单号" width="150" show-overflow-tooltip>
                    <template slot-scope="{ row }">
                        <span v-if="row.groups == 3">{{row.ourier_number}}</span>
                        <span v-else>{{row.courier_number}}</span>
                    </template>
                </el-table-column>
                <el-table-column prop="status" label="审核状态">
                    <template slot-scope="{ row }">
                        <el-tag size="mini" v-if="row.status==-1" type="info">未发起</el-tag>
                        <el-tag size="mini" v-else-if="row.status==0">审核中</el-tag>
                        <el-tag size="mini" v-else-if="row.status==1" type="success">已通过</el-tag>
                        <el-tag size="mini" v-else-if="row.status==2" type="danger">已拒绝</el-tag>
                        <el-tag size="mini" v-else-if="row.status==3" type="warning">已撤回</el-tag>
                        <el-tag size="mini" v-else-if="row.status==4" type="info">已撤销</el-tag>
                        <el-tag size="mini" v-else>{{ row.status }}</el-tag>
                    </template>
                </el-table-column>
                <el-table-column prop="data_return" label="归还状态">
                    <template slot-scope="{ row }">
                        <el-tag size="mini" v-if="row.data_return==0" type="info">未归还</el-tag>
                        <el-tag size="mini" v-else-if="row.data_return==1" type="warning">部分归还</el-tag>
                        <el-tag size="mini" v-else-if="row.data_return==2" type="success">全部归还</el-tag>
                        <el-tag size="mini" v-else>{{ row.data_return }}</el-tag>
                    </template>
                </el-table-column>
                <el-table-column prop="is_push" label="推送状态">
                    <template slot-scope="{ row }">
                        <el-tag size="mini" v-if="row.is_push==0" type="info">未推送</el-tag>
                        <el-tag size="mini" v-else-if="row.is_push==1" type="success">成功</el-tag>
                        <el-tag size="mini" v-else-if="row.is_push==2" type="danger">失败</el-tag>
                        <el-tag size="mini" v-else-if="row.is_push==3" type="warning">取消</el-tag>
                        <el-tag size="mini" v-else>{{ row.is_push }}</el-tag>
                    </template>
                </el-table-column>
                <el-table-column label="操作" fixed="right" width="150">
                    <template scope="{ row }">
                        <el-button class="el-icon-document" type="text" size="small" @click="detailBtn(row)">&nbsp;详情</el-button>
                        <el-button class="el-icon-share" type="text" size="small" @click="processBtn(row)"  :disabled="!(row.approval_id)">&nbsp;审批进度</el-button>
                    </template>
                </el-table-column>
            </el-table>
            <!--翻页栏-->
            <div style="margin-top: 4px;overflow: hidden;">
                <Page style="float: right;" :total="total" :current="page" :page-size="limit" show-total @on-change="pageChange"></Page>
            </div>
        </el-col>

        <!--我要借出-->
        <el-drawer title="我要借出" :visible.sync="lendVisible" size="1200px" direction="rtl" :wrapperClosable="false">
            <my-lend-give v-if="lendVisible" :groups=2 :logistics="logistics" @close-hander="closeBtn" @data-hander="getData"></my-lend-give>
        </el-drawer>

        <!--我要赠送-->
        <el-drawer title="我要赠送" :visible.sync="giveVisible" size="1200px" direction="rtl" :wrapperClosable="false">
            <my-lend-give v-if="giveVisible" :groups=1 :logistics="logistics" @close-hander="closeBtn" @data-hander="getData"></my-lend-give>
        </el-drawer>

        <!--我要赠送-->
        <el-drawer title="我要销售" :visible.sync="saleVisible" size="1200px" direction="rtl" :wrapperClosable="false">
            <my-lend-give v-if="saleVisible" :groups=4 :logistics="logistics" @close-hander="closeBtn" @data-hander="getData"></my-lend-give>
        </el-drawer>

        <!--详情(借)-->
        <el-drawer title="详情（借出）" :visible.sync="detailJVisible" size="1200px" direction="rtl" :wrapperClosable="false" :before-close="closeBtn">
            <el-row style="padding: 0 20px;">
                <el-row>
                    <span style="font-size: 18px;font-weight: bold;vertical-align: top;color: black;margin-right: 4px;">{{detail.allocation_number}}</span>
                    <el-tag size="small" v-if="detail.status==-1" type="info">未发起</el-tag>
                    <el-tag size="small" v-else-if="detail.status==0">审核中</el-tag>
                    <el-tag size="small" v-else-if="detail.status==1" type="success">已通过</el-tag>
                    <el-tag size="small" v-else-if="detail.status==2" type="danger">已拒绝</el-tag>
                    <el-tag size="small" v-else-if="detail.status==3" type="warning">已撤回</el-tag>
                    <el-tag size="small" v-else-if="detail.status==4" type="info">已撤销</el-tag>
                    <el-tag size="small" v-else>{{ detail.status }}</el-tag>
                    &nbsp;
                    <el-tag size="small" v-if="detail.data_return==0" type="info">未归还</el-tag>
                    <el-tag size="small" v-else-if="detail.data_return==1" type="warning">部分归还</el-tag>
                    <el-tag size="small" v-else-if="detail.data_return==2" type="success">全部归还</el-tag>
                    <el-tag size="small" v-else>{{ detail.data_return }}</el-tag>
                    &nbsp;&nbsp;
                    <span style="color: #999;">发起人：{{detail.adduser}}</span>
                    &nbsp;&nbsp;
                    <span style="color: #999;">发起时间：{{detail.createtime}}</span>
                </el-row>
                <el-row style="font-size: 14px;margin-top: 10px;">
                    <el-col :span="2" style="font-size: 16px">
                        <span style="color: rgb(44, 112, 214)">借出</span> / <span :style="{color: detail.data_status==0 ? '#67C23A':'#ed4014'}">{{detail.data_status==0?"正常":"关闭"}}</span>
                    </el-col>
                    <el-col :span="18">
                        计划借出数 / 实际借出数：
                        <span style="font-weight: bold;font-size: 16px;">{{detail.plan_num}}</span> /
                        <span style="font-weight: bold;font-size: 16px;color: #ed4014">{{detail.actually_num}}</span>&nbsp;&nbsp;&nbsp;
                        已归还数：<span style="font-weight: bold;font-size: 16px;color: #67C23A">{{detail.actually_return_num}}</span>&nbsp;&nbsp;&nbsp;
                        已转内购数：<span style="font-weight: bold;font-size: 16px;color: #e6a23c">{{detail.ipurchase_num}}</span>&nbsp;&nbsp;&nbsp;
                        已转赠送数：<span style="font-weight: bold;font-size: 16px;color: #2d8cf0">{{detail.give_num}}</span>&nbsp;&nbsp;&nbsp;
                        已转销售数：<span style="font-weight: bold;font-size: 16px;color: #d32cbd">{{detail.sale_num}}</span>
                    </el-col>
                </el-row>
                <el-row style="font-size: 12px;margin-top: 10px">
                    <el-col :span="9">
                        <div style="display: inline-block;border: 1px solid rgb(45, 140, 240);width: 20px;height: 20px;line-height: 20px;text-align: center;border-radius: 20px;">邮</div>
                        运输方式：<span>{{detail.transport_type || "--"}}</span>&nbsp;&nbsp;
                        快递单号：<span>{{detail.courier_number || "--"}}</span>
                    </el-col>
                    <el-col :span="15" style="color: #999;font-size:12px;">
                        <span>{{detail.wp_province+detail.wp_city+detail.wp_area+detail.wp_address}}</span>&nbsp;
                        <span>{{ detail.wp_user }}</span>&nbsp;
                        <span>{{ detail.wp_phone }}</span>
                    </el-col>
                </el-row>
                <el-row style="font-size: 12px;margin-top: 10px">
                    <div style="display: inline-block;border: 1px solid rgb(45, 140, 240);width: 20px;height: 20px;line-height: 20px;text-align: center;border-radius: 20px;">备</div>
                    <span>{{ detail.remark || "--" }}</span>&nbsp;&nbsp;
                    申请事由：<span>{{detail.reason}}</span>
                </el-row>
                <el-row style="margin-top: 20px">
                    <el-tabs type="border-card" v-model="tab">
                        <el-tab-pane label="借出列表" name="all">
                            <el-button type="primary" size="mini" @click="openReturnBtn" :disabled="detail.data_status==1 || selectedData.length==0">归还所选</el-button>
                            <el-button type="primary" size="mini" @click="openIpurchaseBtn" plain :disabled="detail.data_status==1 || selectedData.length==0">未归还转内购</el-button>
                            <el-button type="warning" size="mini" @click="openGiveBtn" plain :disabled="detail.data_status==1 || selectedData.length==0">未归还转赠送</el-button>
                            <el-table :data="detailJList" style="width: 100%" :max-height="drawerTableHeight2" v-loading="loading" size="mini"
                                      @selection-change="selectedTableBtn">
                                <el-table-column type="selection" width="55" :selectable="selectable"></el-table-column>
                                <el-table-column prop="img" label="图片" width="50">
                                    <template slot-scope="{row}">
                                        <el-image :src="row.img" fit="contian" :preview-src-list="[row.img]">
                                            <div slot="error" class="image-slot">
                                                <svg t="1718681716906" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2623" width="20" height="20"><path d="M400.696 268.795c-17.249 0-31.233 13.986-31.233 31.233v30.471c0 17.249 13.986 31.233 31.233 31.233s31.233-13.986 31.233-31.233v-30.471c0-17.249-13.985-31.233-31.233-31.233z" fill="#999999" p-id="2624"></path><path d="M623.649 361.734c17.249 0 31.234-13.986 31.234-31.233v-30.471c0-17.249-13.986-31.233-31.234-31.233s-31.233 13.986-31.233 31.233v30.471c-0.001 17.248 13.985 31.233 31.233 31.233z" fill="#999999" p-id="2625"></path><path d="M438.295 388.804c-14.656 9.104-19.155 28.362-10.050 43.013 11.209 18.047 41.976 48.59 86.157 48.59 43.958 0 75.1-30.313 86.574-48.223 9.303-14.529 5.068-33.847-9.455-43.15-14.539-9.298-33.852-5.068-43.15 9.455-0.122 0.199-13.38 19.45-33.969 19.45-20.009 0-32.444-18.128-33.278-19.373-9.166-14.423-28.28-18.805-42.829-9.761z" fill="#999999" p-id="2626"></path><path d="M824.508503 116.690676 571.592236 116.690676c-17.248849 0-31.233352 13.985526-31.233352 31.233352s13.985526 31.233352 31.233352 31.233352l252.916267 0c40.181141 0 72.878844 32.692586 72.878844 72.878844l0 396.966057-189.334159-165.29465c-12.20088-10.655687-30.517037-10.207479-42.173518 0.9967L468.578048 674.16231 309.521472 517.519714c-11.895935-11.70253-30.903847-12.002358-43.154869-0.645706L126.957507 646.163629l0-394.126382c0-40.186258 32.692586-72.878844 72.878844-72.878844l252.916267 0c17.248849 0 31.233352-13.985526 31.233352-31.233352S470.000444 116.690676 452.751594 116.690676L199.836351 116.690676c-74.632791 0-135.346571 60.71378-135.346571 135.346571l0 520.56405c0 74.632791 60.71378 135.346571 135.346571 135.346571l252.916267 0c17.248849 0 31.233352-13.985526 31.233352-31.233352s-13.985526-31.233352-31.233352-31.233352L199.836351 845.481164c-40.186258 0-72.878844-32.692586-72.878844-72.878844l0-41.23924 160.003134-148.385539 159.428036 157.007917c12.048407 11.865235 31.361265 11.981892 43.546795 0.274246l198.576661-190.68697 208.876238 182.346001 0 40.683585c0 40.186258-32.697703 72.878844-72.878844 72.878844L571.592236 845.481164c-17.248849 0-31.233352 13.985526-31.233352 31.233352s13.985526 31.233352 31.233352 31.233352l252.916267 0c74.627674 0 135.346571-60.71378 135.346571-135.346571L959.855074 252.037247C959.855074 177.404456 899.136178 116.690676 824.508503 116.690676z" fill="#999999" p-id="2627"></path></svg>
                                            </div>
                                        </el-image>
                                    </template>
                                </el-table-column>
                                <el-table-column prop="type_name" label="款名" show-overflow-tooltip></el-table-column>
                                <el-table-column prop="sku_code" label="规格编码" width="140"></el-table-column>
                                <el-table-column prop="num" label="计划借出/实际借出数量" width="150">
                                    <template slot-scope="{row}">
                                        <span style="font-size: 16px;font-weight: bold">{{row.num}}</span> /
                                        <span style="font-size: 16px;font-weight: bold;color: #ed4014">{{row.actually_num}}</span>
                                    </template>
                                </el-table-column>
                                <el-table-column prop="actually_return_num" label="已归还数">
                                    <template slot-scope="{row}">
                                        <span style="font-size: 16px;font-weight: bold" :style="{color: row.actually_return_num==0?'#dcdee2':''}">{{row.actually_return_num}}</span>
                                    </template>
                                </el-table-column>
                                <el-table-column prop="ipurchase_num" label="已转内购数">
                                    <template slot-scope="{row}">
                                        <span style="font-size: 16px;font-weight: bold" :style="{color: row.ipurchase_num==0?'#dcdee2':''}">{{row.ipurchase_num}}</span>
                                    </template>
                                </el-table-column>
                                <el-table-column prop="give_num" label="已转赠送数">
                                    <template slot-scope="{row}">
                                        <span style="font-size: 16px;font-weight: bold" :style="{color: row.give_num==0?'#dcdee2':''}">{{row.give_num}}</span>
                                    </template>
                                </el-table-column>
                                <el-table-column prop="sale_num" label="已转销售数">
                                    <template slot-scope="{row}">
                                        <span style="font-size: 16px;font-weight: bold" :style="{color: row.sale_num==0?'#dcdee2':''}">{{row.sale_num}}</span>
                                    </template>
                                </el-table-column>
                                <el-table-column prop="is_return" label="归还状态">
                                    <template slot-scope="{row}">
                                        <el-tag size="mini" v-if="row.is_return == 1" type="warning">部分归还</el-tag>
                                        <el-tag size="mini" v-else-if="row.is_return == 2" type="success">全部归还</el-tag>
                                        <el-tag size="mini" v-else type="info">未归还</el-tag>
                                    </template>
                                </el-table-column>
                            </el-table>
                        </el-tab-pane>
                        <el-tab-pane :label="'归还'+(detailHList.length==0 ?'':'：'+detailHList.length)" name="return">
                            <el-table :data="detailHList" style="width: 100%" :max-height="drawerTableHeight" v-loading="loading" size="mini">
                                <el-table-column prop="img" label="图片" width="50">
                                    <template slot-scope="{row}">
                                        <el-image :src="row.img" fit="contian" :preview-src-list="[row.img]">
                                            <div slot="error" class="image-slot">
                                                <svg t="1718681716906" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2623" width="20" height="20"><path d="M400.696 268.795c-17.249 0-31.233 13.986-31.233 31.233v30.471c0 17.249 13.986 31.233 31.233 31.233s31.233-13.986 31.233-31.233v-30.471c0-17.249-13.985-31.233-31.233-31.233z" fill="#999999" p-id="2624"></path><path d="M623.649 361.734c17.249 0 31.234-13.986 31.234-31.233v-30.471c0-17.249-13.986-31.233-31.234-31.233s-31.233 13.986-31.233 31.233v30.471c-0.001 17.248 13.985 31.233 31.233 31.233z" fill="#999999" p-id="2625"></path><path d="M438.295 388.804c-14.656 9.104-19.155 28.362-10.050 43.013 11.209 18.047 41.976 48.59 86.157 48.59 43.958 0 75.1-30.313 86.574-48.223 9.303-14.529 5.068-33.847-9.455-43.15-14.539-9.298-33.852-5.068-43.15 9.455-0.122 0.199-13.38 19.45-33.969 19.45-20.009 0-32.444-18.128-33.278-19.373-9.166-14.423-28.28-18.805-42.829-9.761z" fill="#999999" p-id="2626"></path><path d="M824.508503 116.690676 571.592236 116.690676c-17.248849 0-31.233352 13.985526-31.233352 31.233352s13.985526 31.233352 31.233352 31.233352l252.916267 0c40.181141 0 72.878844 32.692586 72.878844 72.878844l0 396.966057-189.334159-165.29465c-12.20088-10.655687-30.517037-10.207479-42.173518 0.9967L468.578048 674.16231 309.521472 517.519714c-11.895935-11.70253-30.903847-12.002358-43.154869-0.645706L126.957507 646.163629l0-394.126382c0-40.186258 32.692586-72.878844 72.878844-72.878844l252.916267 0c17.248849 0 31.233352-13.985526 31.233352-31.233352S470.000444 116.690676 452.751594 116.690676L199.836351 116.690676c-74.632791 0-135.346571 60.71378-135.346571 135.346571l0 520.56405c0 74.632791 60.71378 135.346571 135.346571 135.346571l252.916267 0c17.248849 0 31.233352-13.985526 31.233352-31.233352s-13.985526-31.233352-31.233352-31.233352L199.836351 845.481164c-40.186258 0-72.878844-32.692586-72.878844-72.878844l0-41.23924 160.003134-148.385539 159.428036 157.007917c12.048407 11.865235 31.361265 11.981892 43.546795 0.274246l198.576661-190.68697 208.876238 182.346001 0 40.683585c0 40.186258-32.697703 72.878844-72.878844 72.878844L571.592236 845.481164c-17.248849 0-31.233352 13.985526-31.233352 31.233352s13.985526 31.233352 31.233352 31.233352l252.916267 0c74.627674 0 135.346571-60.71378 135.346571-135.346571L959.855074 252.037247C959.855074 177.404456 899.136178 116.690676 824.508503 116.690676z" fill="#999999" p-id="2627"></path></svg>
                                            </div>
                                        </el-image>
                                    </template>
                                </el-table-column>
                                <el-table-column prop="allocation_number" label="归还单号" width="167"></el-table-column>
                                <el-table-column prop="type_name" label="款名" show-overflow-tooltip></el-table-column>
                                <el-table-column prop="sku_code" label="规格编码" width="140"></el-table-column>
                                <el-table-column prop="num" label="计划归还数" width="150">
                                    <template slot-scope="{row}">
                                        <span style="font-size: 16px;font-weight: bold">{{row.num}}</span>
                                    </template>
                                </el-table-column>
                                <el-table-column prop="actually_return_num" label="已归还数">
                                    <template slot-scope="{row}">
                                        <span style="font-size: 16px;font-weight: bold" :style="{color: row.actually_num==0?'#dcdee2':''}">{{row.actually_num}}</span>
                                    </template>
                                </el-table-column>
                                <el-table-column prop="adduser" label="发起人"></el-table-column>
                                <el-table-column prop="createtime" label="发起时间" width="135"></el-table-column>
                                <el-table-column prop="is_return" label="归还审核状态" width="120">
                                    <template slot-scope="{row}">
                                        <el-tag size="mini" v-if="row.status==-1" type="info">未发起</el-tag>
                                        <el-tag size="mini" v-else-if="row.status==0">审核中</el-tag>
                                        <el-tag size="mini" v-else-if="row.status==1" type="success">已通过</el-tag>
                                        <el-tag size="mini" v-else-if="row.status==2" type="danger">已拒绝</el-tag>
                                        <el-tag size="mini" v-else-if="row.status==3" type="warning">已撤销</el-tag>
                                        <el-tag size="mini" v-else>{{ row.status }}</el-tag>
                                    </template>
                                </el-table-column>
                            </el-table>
                        </el-tab-pane>
                        <el-tab-pane :label="'转内购'+(detailZNGList.length==0 ?'':'：'+detailZNGList.length)" name="ipurchase">
                            <el-table :data="detailZNGList" style="width: 100%" :max-height="drawerTableHeight" v-loading="loading" size="mini">
                                <el-table-column prop="img" label="图片" width="50">
                                    <template slot-scope="{row}">
                                        <el-image :src="row.img" fit="contian" :preview-src-list="[row.img]">
                                            <div slot="error" class="image-slot">
                                                <svg t="1718681716906" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2623" width="20" height="20"><path d="M400.696 268.795c-17.249 0-31.233 13.986-31.233 31.233v30.471c0 17.249 13.986 31.233 31.233 31.233s31.233-13.986 31.233-31.233v-30.471c0-17.249-13.985-31.233-31.233-31.233z" fill="#999999" p-id="2624"></path><path d="M623.649 361.734c17.249 0 31.234-13.986 31.234-31.233v-30.471c0-17.249-13.986-31.233-31.234-31.233s-31.233 13.986-31.233 31.233v30.471c-0.001 17.248 13.985 31.233 31.233 31.233z" fill="#999999" p-id="2625"></path><path d="M438.295 388.804c-14.656 9.104-19.155 28.362-10.050 43.013 11.209 18.047 41.976 48.59 86.157 48.59 43.958 0 75.1-30.313 86.574-48.223 9.303-14.529 5.068-33.847-9.455-43.15-14.539-9.298-33.852-5.068-43.15 9.455-0.122 0.199-13.38 19.45-33.969 19.45-20.009 0-32.444-18.128-33.278-19.373-9.166-14.423-28.28-18.805-42.829-9.761z" fill="#999999" p-id="2626"></path><path d="M824.508503 116.690676 571.592236 116.690676c-17.248849 0-31.233352 13.985526-31.233352 31.233352s13.985526 31.233352 31.233352 31.233352l252.916267 0c40.181141 0 72.878844 32.692586 72.878844 72.878844l0 396.966057-189.334159-165.29465c-12.20088-10.655687-30.517037-10.207479-42.173518 0.9967L468.578048 674.16231 309.521472 517.519714c-11.895935-11.70253-30.903847-12.002358-43.154869-0.645706L126.957507 646.163629l0-394.126382c0-40.186258 32.692586-72.878844 72.878844-72.878844l252.916267 0c17.248849 0 31.233352-13.985526 31.233352-31.233352S470.000444 116.690676 452.751594 116.690676L199.836351 116.690676c-74.632791 0-135.346571 60.71378-135.346571 135.346571l0 520.56405c0 74.632791 60.71378 135.346571 135.346571 135.346571l252.916267 0c17.248849 0 31.233352-13.985526 31.233352-31.233352s-13.985526-31.233352-31.233352-31.233352L199.836351 845.481164c-40.186258 0-72.878844-32.692586-72.878844-72.878844l0-41.23924 160.003134-148.385539 159.428036 157.007917c12.048407 11.865235 31.361265 11.981892 43.546795 0.274246l198.576661-190.68697 208.876238 182.346001 0 40.683585c0 40.186258-32.697703 72.878844-72.878844 72.878844L571.592236 845.481164c-17.248849 0-31.233352 13.985526-31.233352 31.233352s13.985526 31.233352 31.233352 31.233352l252.916267 0c74.627674 0 135.346571-60.71378 135.346571-135.346571L959.855074 252.037247C959.855074 177.404456 899.136178 116.690676 824.508503 116.690676z" fill="#999999" p-id="2627"></path></svg>
                                            </div>
                                        </el-image>
                                    </template>
                                </el-table-column>
                                <el-table-column prop="allocation_number" label="内购单号" width="167"></el-table-column>
                                <el-table-column prop="type_name" label="款名" show-overflow-tooltip></el-table-column>
                                <el-table-column prop="sku_code" label="规格编码" width="140"></el-table-column>
                                <el-table-column prop="num" label="内购数量" width="150">
                                    <template slot-scope="{row}">
                                        <span style="font-size: 16px;font-weight: bold">{{row.num}}</span>
                                    </template>
                                </el-table-column>
                                <el-table-column prop="adduser" label="发起人"></el-table-column>
                                <el-table-column prop="createtime" label="发起时间" width="135"></el-table-column>
                                <el-table-column prop="status" label="内购审核状态" width="120">
                                    <template slot-scope="{row}">
                                        <el-tag size="mini" v-if="row.status==-1" type="info">未发起</el-tag>
                                        <el-tag size="mini" v-else-if="row.status==0">审核中</el-tag>
                                        <el-tag size="mini" v-else-if="row.status==1" type="success">已通过</el-tag>
                                        <el-tag size="mini" v-else-if="row.status==2" type="danger">已拒绝</el-tag>
                                        <el-tag size="mini" v-else-if="row.status==3" type="warning">已撤销</el-tag>
                                        <el-tag size="mini" v-else>{{ row.status }}</el-tag>
                                    </template>
                                </el-table-column>
                            </el-table>
                        </el-tab-pane>
                        <el-tab-pane :label="'转赠送'+(detailJZSList.length==0 ?'':'：'+detailJZSList.length)" name="giv">
                            <el-table :data="detailJZSList" style="width: 100%" :max-height="drawerTableHeight" v-loading="loading" size="mini">
                                <el-table-column prop="img" label="图片" width="50">
                                    <template slot-scope="{row}">
                                        <el-image :src="row.img" fit="contian" :preview-src-list="[row.img]">
                                            <div slot="error" class="image-slot">
                                                <svg t="1718681716906" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2623" width="20" height="20"><path d="M400.696 268.795c-17.249 0-31.233 13.986-31.233 31.233v30.471c0 17.249 13.986 31.233 31.233 31.233s31.233-13.986 31.233-31.233v-30.471c0-17.249-13.985-31.233-31.233-31.233z" fill="#999999" p-id="2624"></path><path d="M623.649 361.734c17.249 0 31.234-13.986 31.234-31.233v-30.471c0-17.249-13.986-31.233-31.234-31.233s-31.233 13.986-31.233 31.233v30.471c-0.001 17.248 13.985 31.233 31.233 31.233z" fill="#999999" p-id="2625"></path><path d="M438.295 388.804c-14.656 9.104-19.155 28.362-10.050 43.013 11.209 18.047 41.976 48.59 86.157 48.59 43.958 0 75.1-30.313 86.574-48.223 9.303-14.529 5.068-33.847-9.455-43.15-14.539-9.298-33.852-5.068-43.15 9.455-0.122 0.199-13.38 19.45-33.969 19.45-20.009 0-32.444-18.128-33.278-19.373-9.166-14.423-28.28-18.805-42.829-9.761z" fill="#999999" p-id="2626"></path><path d="M824.508503 116.690676 571.592236 116.690676c-17.248849 0-31.233352 13.985526-31.233352 31.233352s13.985526 31.233352 31.233352 31.233352l252.916267 0c40.181141 0 72.878844 32.692586 72.878844 72.878844l0 396.966057-189.334159-165.29465c-12.20088-10.655687-30.517037-10.207479-42.173518 0.9967L468.578048 674.16231 309.521472 517.519714c-11.895935-11.70253-30.903847-12.002358-43.154869-0.645706L126.957507 646.163629l0-394.126382c0-40.186258 32.692586-72.878844 72.878844-72.878844l252.916267 0c17.248849 0 31.233352-13.985526 31.233352-31.233352S470.000444 116.690676 452.751594 116.690676L199.836351 116.690676c-74.632791 0-135.346571 60.71378-135.346571 135.346571l0 520.56405c0 74.632791 60.71378 135.346571 135.346571 135.346571l252.916267 0c17.248849 0 31.233352-13.985526 31.233352-31.233352s-13.985526-31.233352-31.233352-31.233352L199.836351 845.481164c-40.186258 0-72.878844-32.692586-72.878844-72.878844l0-41.23924 160.003134-148.385539 159.428036 157.007917c12.048407 11.865235 31.361265 11.981892 43.546795 0.274246l198.576661-190.68697 208.876238 182.346001 0 40.683585c0 40.186258-32.697703 72.878844-72.878844 72.878844L571.592236 845.481164c-17.248849 0-31.233352 13.985526-31.233352 31.233352s13.985526 31.233352 31.233352 31.233352l252.916267 0c74.627674 0 135.346571-60.71378 135.346571-135.346571L959.855074 252.037247C959.855074 177.404456 899.136178 116.690676 824.508503 116.690676z" fill="#999999" p-id="2627"></path></svg>
                                            </div>
                                        </el-image>
                                    </template>
                                </el-table-column>
                                <el-table-column prop="allocation_number" label="赠送单号" width="167"></el-table-column>
                                <el-table-column prop="type_name" label="款名" show-overflow-tooltip></el-table-column>
                                <el-table-column prop="sku_code" label="规格编码" width="140"></el-table-column>
                                <el-table-column prop="num" label="赠送数量" width="150">
                                    <template slot-scope="{row}">
                                        <span style="font-size: 16px;font-weight: bold">{{row.num}}</span>
                                    </template>
                                </el-table-column>
                                <el-table-column prop="adduser" label="发起人"></el-table-column>
                                <el-table-column prop="createtime" label="发起时间" width="135"></el-table-column>
                                <el-table-column prop="status" label="赠送审核状态" width="120">
                                    <template slot-scope="{row}">
                                        <el-tag size="mini" v-if="row.status==-1" type="info">未发起</el-tag>
                                        <el-tag size="mini" v-else-if="row.status==0">审核中</el-tag>
                                        <el-tag size="mini" v-else-if="row.status==1" type="success">已通过</el-tag>
                                        <el-tag size="mini" v-else-if="row.status==2" type="danger">已拒绝</el-tag>
                                        <el-tag size="mini" v-else-if="row.status==3" type="warning">已撤销</el-tag>
                                        <el-tag size="mini" v-else>{{ row.status }}</el-tag>
                                    </template>
                                </el-table-column>
                            </el-table>
                        </el-tab-pane>
                        <el-tab-pane :label="'转销售'+(detailJZXList.length==0 ?'':'：'+detailJZXList.length)" name="sale">
                            <el-table :data="detailJZXList" style="width: 100%" :max-height="drawerTableHeight" v-loading="loading" size="mini">
                                <el-table-column prop="img" label="图片" width="50">
                                    <template slot-scope="{row}">
                                        <el-image :src="row.img" fit="contian" :preview-src-list="[row.img]">
                                            <div slot="error" class="image-slot">
                                                <svg t="1718681716906" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2623" width="20" height="20"><path d="M400.696 268.795c-17.249 0-31.233 13.986-31.233 31.233v30.471c0 17.249 13.986 31.233 31.233 31.233s31.233-13.986 31.233-31.233v-30.471c0-17.249-13.985-31.233-31.233-31.233z" fill="#999999" p-id="2624"></path><path d="M623.649 361.734c17.249 0 31.234-13.986 31.234-31.233v-30.471c0-17.249-13.986-31.233-31.234-31.233s-31.233 13.986-31.233 31.233v30.471c-0.001 17.248 13.985 31.233 31.233 31.233z" fill="#999999" p-id="2625"></path><path d="M438.295 388.804c-14.656 9.104-19.155 28.362-10.050 43.013 11.209 18.047 41.976 48.59 86.157 48.59 43.958 0 75.1-30.313 86.574-48.223 9.303-14.529 5.068-33.847-9.455-43.15-14.539-9.298-33.852-5.068-43.15 9.455-0.122 0.199-13.38 19.45-33.969 19.45-20.009 0-32.444-18.128-33.278-19.373-9.166-14.423-28.28-18.805-42.829-9.761z" fill="#999999" p-id="2626"></path><path d="M824.508503 116.690676 571.592236 116.690676c-17.248849 0-31.233352 13.985526-31.233352 31.233352s13.985526 31.233352 31.233352 31.233352l252.916267 0c40.181141 0 72.878844 32.692586 72.878844 72.878844l0 396.966057-189.334159-165.29465c-12.20088-10.655687-30.517037-10.207479-42.173518 0.9967L468.578048 674.16231 309.521472 517.519714c-11.895935-11.70253-30.903847-12.002358-43.154869-0.645706L126.957507 646.163629l0-394.126382c0-40.186258 32.692586-72.878844 72.878844-72.878844l252.916267 0c17.248849 0 31.233352-13.985526 31.233352-31.233352S470.000444 116.690676 452.751594 116.690676L199.836351 116.690676c-74.632791 0-135.346571 60.71378-135.346571 135.346571l0 520.56405c0 74.632791 60.71378 135.346571 135.346571 135.346571l252.916267 0c17.248849 0 31.233352-13.985526 31.233352-31.233352s-13.985526-31.233352-31.233352-31.233352L199.836351 845.481164c-40.186258 0-72.878844-32.692586-72.878844-72.878844l0-41.23924 160.003134-148.385539 159.428036 157.007917c12.048407 11.865235 31.361265 11.981892 43.546795 0.274246l198.576661-190.68697 208.876238 182.346001 0 40.683585c0 40.186258-32.697703 72.878844-72.878844 72.878844L571.592236 845.481164c-17.248849 0-31.233352 13.985526-31.233352 31.233352s13.985526 31.233352 31.233352 31.233352l252.916267 0c74.627674 0 135.346571-60.71378 135.346571-135.346571L959.855074 252.037247C959.855074 177.404456 899.136178 116.690676 824.508503 116.690676z" fill="#999999" p-id="2627"></path></svg>
                                            </div>
                                        </el-image>
                                    </template>
                                </el-table-column>
                                <el-table-column prop="allocation_number" label="销售单号" width="167"></el-table-column>
                                <el-table-column prop="type_name" label="款名" show-overflow-tooltip></el-table-column>
                                <el-table-column prop="sku_code" label="规格编码" width="140"></el-table-column>
                                <el-table-column prop="num" label="销售数量" width="150">
                                    <template slot-scope="{row}">
                                        <span style="font-size: 16px;font-weight: bold">{{row.num}}</span>
                                    </template>
                                </el-table-column>
                                <el-table-column prop="adduser" label="发起人"></el-table-column>
                                <el-table-column prop="createtime" label="发起时间" width="135"></el-table-column>
                                <el-table-column prop="status" label="销售审核状态" width="120">
                                    <template slot-scope="{row}">
                                        <el-tag size="mini" v-if="row.status==-1" type="info">未发起</el-tag>
                                        <el-tag size="mini" v-else-if="row.status==0">审核中</el-tag>
                                        <el-tag size="mini" v-else-if="row.status==1" type="success">已通过</el-tag>
                                        <el-tag size="mini" v-else-if="row.status==2" type="danger">已拒绝</el-tag>
                                        <el-tag size="mini" v-else-if="row.status==3" type="warning">已撤销</el-tag>
                                        <el-tag size="mini" v-else>{{ row.status }}</el-tag>
                                    </template>
                                </el-table-column>
                            </el-table>
                        </el-tab-pane>
                    </el-tabs>
                </el-row>
            </el-row>
        </el-drawer>

        <!--详情(赠)-->
        <el-drawer title="详情（赠送）" :visible.sync="detailZVisible" size="1200px" direction="rtl" :wrapperClosable="false" :before-close="closeBtn">
            <el-row style="padding: 0 20px;">
                <el-row>
                    <span style="font-size: 18px;font-weight: bold;vertical-align: top;color: black;margin-right: 4px;">{{detail.allocation_number}}</span>
                    <el-tag size="small" v-if="detail.status==-1" type="info">未发起</el-tag>
                    <el-tag size="small" v-else-if="detail.status==0">审核中</el-tag>
                    <el-tag size="small" v-else-if="detail.status==1" type="success">已通过</el-tag>
                    <el-tag size="small" v-else-if="detail.status==2" type="danger">已拒绝</el-tag>
                    <el-tag size="small" v-else-if="detail.status==3" type="warning">已撤回</el-tag>
                    <el-tag size="small" v-else-if="detail.status==4" type="info">已撤销</el-tag>
                    <el-tag size="small" v-else>{{ detail.status }}</el-tag>
                    &nbsp;
                    <el-tag size="small" v-if="detail.data_return==0" type="info">未归还</el-tag>
                    <el-tag  effect="plain" size="small" v-else-if="detail.data_return==1" type="warning">部分归还</el-tag>
                    <el-tag size="small" v-else-if="detail.data_return==2" type="success">全部归还</el-tag>
                    <el-tag size="small" v-else>{{ detail.data_return }}</el-tag>
                    &nbsp;&nbsp;
                    <span style="color: #999;">发起人：{{detail.adduser}}</span>
                    &nbsp;&nbsp;
                    <span style="color: #999;">发起时间：{{detail.createtime}}</span>
                </el-row>
                <el-row style="font-size: 14px;margin-top: 10px;">
                    <el-col :span="2" style="font-size: 16px">
                        <span style="color: rgb(44, 112, 214)">赠送</span> / <span :style="{color: detail.data_status==0 ? '#67C23A':'#ed4014'}">{{detail.data_status==0?"正常":"关闭"}}</span>
                    </el-col>
                    <el-col :span="18">
                        计划赠送数 / 实际赠送数：
                        <span style="font-weight: bold;font-size: 16px;">{{detail.plan_num}}</span> /
                        <span style="font-weight: bold;font-size: 16px;color: #ed4014">{{detail.actually_num}}</span>&nbsp;&nbsp;&nbsp;
                        已归还数：<span style="font-weight: bold;font-size: 16px;color: #67C23A">{{detail.actually_return_num}}</span>
                    </el-col>
                </el-row>
                <el-row style="font-size: 12px;margin-top: 10px">
                    <el-col :span="9">
                        <div style="display: inline-block;border: 1px solid rgb(45, 140, 240);width: 20px;height: 20px;line-height: 20px;text-align: center;border-radius: 20px;">邮</div>
                        运输方式：<span>{{detail.transport_type || "--"}}</span>&nbsp;&nbsp;
                        快递单号：<span>{{detail.courier_number || "--"}}</span>
                    </el-col>
                    <el-col :span="15" style="color: #999;font-size:12px;">
                        <span>{{detail.wp_province+detail.wp_city+detail.wp_area+detail.wp_address}}</span>&nbsp;
                        <span>{{ detail.wp_user }}</span>&nbsp;
                        <span>{{ detail.wp_phone }}</span>
                    </el-col>
                </el-row>
                <el-row style="font-size: 12px;margin-top: 10px">
                    <div style="display: inline-block;border: 1px solid rgb(45, 140, 240);width: 20px;height: 20px;line-height: 20px;text-align: center;border-radius: 20px;">备</div>
                    <span>{{ detail.remark || "--" }}</span>&nbsp;&nbsp;
                    申请事由：<span>{{detail.reason}}</span>
                </el-row>
                <el-row style="margin-top: 20px">
                    <el-tabs type="border-card" v-model="tab">
                        <el-tab-pane label="赠送列表" name="all">
                            <el-button type="primary" size="mini" @click="openReturnGiveBtn" :disabled="detail.data_status==1 || selectedData.length==0">赠送转归还</el-button>
                            <el-table :data="detailZList" style="width: 100%" :max-height="drawerTableHeight2" v-loading="loading" size="mini" @selection-change="selectedTableBtn">
                                <el-table-column type="selection" width="55" :selectable="selectable"></el-table-column>
                                <el-table-column prop="img" label="图片" width="50">
                                    <template slot-scope="{row}">
                                        <el-image :src="row.img" fit="contian" :preview-src-list="[row.img]">
                                            <div slot="error" class="image-slot">
                                                <svg t="1718681716906" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2623" width="20" height="20"><path d="M400.696 268.795c-17.249 0-31.233 13.986-31.233 31.233v30.471c0 17.249 13.986 31.233 31.233 31.233s31.233-13.986 31.233-31.233v-30.471c0-17.249-13.985-31.233-31.233-31.233z" fill="#999999" p-id="2624"></path><path d="M623.649 361.734c17.249 0 31.234-13.986 31.234-31.233v-30.471c0-17.249-13.986-31.233-31.234-31.233s-31.233 13.986-31.233 31.233v30.471c-0.001 17.248 13.985 31.233 31.233 31.233z" fill="#999999" p-id="2625"></path><path d="M438.295 388.804c-14.656 9.104-19.155 28.362-10.050 43.013 11.209 18.047 41.976 48.59 86.157 48.59 43.958 0 75.1-30.313 86.574-48.223 9.303-14.529 5.068-33.847-9.455-43.15-14.539-9.298-33.852-5.068-43.15 9.455-0.122 0.199-13.38 19.45-33.969 19.45-20.009 0-32.444-18.128-33.278-19.373-9.166-14.423-28.28-18.805-42.829-9.761z" fill="#999999" p-id="2626"></path><path d="M824.508503 116.690676 571.592236 116.690676c-17.248849 0-31.233352 13.985526-31.233352 31.233352s13.985526 31.233352 31.233352 31.233352l252.916267 0c40.181141 0 72.878844 32.692586 72.878844 72.878844l0 396.966057-189.334159-165.29465c-12.20088-10.655687-30.517037-10.207479-42.173518 0.9967L468.578048 674.16231 309.521472 517.519714c-11.895935-11.70253-30.903847-12.002358-43.154869-0.645706L126.957507 646.163629l0-394.126382c0-40.186258 32.692586-72.878844 72.878844-72.878844l252.916267 0c17.248849 0 31.233352-13.985526 31.233352-31.233352S470.000444 116.690676 452.751594 116.690676L199.836351 116.690676c-74.632791 0-135.346571 60.71378-135.346571 135.346571l0 520.56405c0 74.632791 60.71378 135.346571 135.346571 135.346571l252.916267 0c17.248849 0 31.233352-13.985526 31.233352-31.233352s-13.985526-31.233352-31.233352-31.233352L199.836351 845.481164c-40.186258 0-72.878844-32.692586-72.878844-72.878844l0-41.23924 160.003134-148.385539 159.428036 157.007917c12.048407 11.865235 31.361265 11.981892 43.546795 0.274246l198.576661-190.68697 208.876238 182.346001 0 40.683585c0 40.186258-32.697703 72.878844-72.878844 72.878844L571.592236 845.481164c-17.248849 0-31.233352 13.985526-31.233352 31.233352s13.985526 31.233352 31.233352 31.233352l252.916267 0c74.627674 0 135.346571-60.71378 135.346571-135.346571L959.855074 252.037247C959.855074 177.404456 899.136178 116.690676 824.508503 116.690676z" fill="#999999" p-id="2627"></path></svg>
                                            </div>
                                        </el-image>
                                    </template>
                                </el-table-column>
                                <el-table-column prop="type_name" label="款名" show-overflow-tooltip></el-table-column>
                                <el-table-column prop="sku_code" label="规格编码" width="140"></el-table-column>
                                <el-table-column prop="num" label="计划赠送/实际赠送数量" width="150">
                                    <template slot-scope="{row}">
                                        <span style="font-size: 16px;font-weight: bold">{{row.num}}</span> /
                                        <span style="font-size: 16px;font-weight: bold;color: #ed4014">{{row.actually_num}}</span>
                                    </template>
                                </el-table-column>
                                <el-table-column prop="actually_return_num" label="已归还数">
                                    <template slot-scope="{row}">
                                        <span style="font-size: 16px;font-weight: bold" :style="{color: row.actually_return_num==0?'#dcdee2':''}">{{row.actually_return_num}}</span>
                                    </template>
                                </el-table-column>
                                <el-table-column prop="is_return" label="归还状态">
                                    <template slot-scope="{row}">
                                        <el-tag size="mini" v-if="row.is_return == 1" type="warning">部分归还</el-tag>
                                        <el-tag size="mini" v-else-if="row.is_return == 2" type="success">全部归还</el-tag>
                                        <el-tag size="mini" v-else type="info">未归还</el-tag>
                                    </template>
                                </el-table-column>
                            </el-table>
                        </el-tab-pane>
                        <el-tab-pane :label="'转归还'+(detailHList.length==0 ?'':'：'+detailHList.length)" name="return">
                            <el-table :data="detailHList" style="width: 100%" :max-height="drawerTableHeight" v-loading="loading" size="mini">
                                <el-table-column prop="img" label="图片" width="50">
                                    <template slot-scope="{row}">
                                        <el-image :src="row.img" fit="contian" :preview-src-list="[row.img]">
                                            <div slot="error" class="image-slot">
                                                <svg t="1718681716906" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2623" width="20" height="20"><path d="M400.696 268.795c-17.249 0-31.233 13.986-31.233 31.233v30.471c0 17.249 13.986 31.233 31.233 31.233s31.233-13.986 31.233-31.233v-30.471c0-17.249-13.985-31.233-31.233-31.233z" fill="#999999" p-id="2624"></path><path d="M623.649 361.734c17.249 0 31.234-13.986 31.234-31.233v-30.471c0-17.249-13.986-31.233-31.234-31.233s-31.233 13.986-31.233 31.233v30.471c-0.001 17.248 13.985 31.233 31.233 31.233z" fill="#999999" p-id="2625"></path><path d="M438.295 388.804c-14.656 9.104-19.155 28.362-10.050 43.013 11.209 18.047 41.976 48.59 86.157 48.59 43.958 0 75.1-30.313 86.574-48.223 9.303-14.529 5.068-33.847-9.455-43.15-14.539-9.298-33.852-5.068-43.15 9.455-0.122 0.199-13.38 19.45-33.969 19.45-20.009 0-32.444-18.128-33.278-19.373-9.166-14.423-28.28-18.805-42.829-9.761z" fill="#999999" p-id="2626"></path><path d="M824.508503 116.690676 571.592236 116.690676c-17.248849 0-31.233352 13.985526-31.233352 31.233352s13.985526 31.233352 31.233352 31.233352l252.916267 0c40.181141 0 72.878844 32.692586 72.878844 72.878844l0 396.966057-189.334159-165.29465c-12.20088-10.655687-30.517037-10.207479-42.173518 0.9967L468.578048 674.16231 309.521472 517.519714c-11.895935-11.70253-30.903847-12.002358-43.154869-0.645706L126.957507 646.163629l0-394.126382c0-40.186258 32.692586-72.878844 72.878844-72.878844l252.916267 0c17.248849 0 31.233352-13.985526 31.233352-31.233352S470.000444 116.690676 452.751594 116.690676L199.836351 116.690676c-74.632791 0-135.346571 60.71378-135.346571 135.346571l0 520.56405c0 74.632791 60.71378 135.346571 135.346571 135.346571l252.916267 0c17.248849 0 31.233352-13.985526 31.233352-31.233352s-13.985526-31.233352-31.233352-31.233352L199.836351 845.481164c-40.186258 0-72.878844-32.692586-72.878844-72.878844l0-41.23924 160.003134-148.385539 159.428036 157.007917c12.048407 11.865235 31.361265 11.981892 43.546795 0.274246l198.576661-190.68697 208.876238 182.346001 0 40.683585c0 40.186258-32.697703 72.878844-72.878844 72.878844L571.592236 845.481164c-17.248849 0-31.233352 13.985526-31.233352 31.233352s13.985526 31.233352 31.233352 31.233352l252.916267 0c74.627674 0 135.346571-60.71378 135.346571-135.346571L959.855074 252.037247C959.855074 177.404456 899.136178 116.690676 824.508503 116.690676z" fill="#999999" p-id="2627"></path></svg>
                                            </div>
                                        </el-image>
                                    </template>
                                </el-table-column>
                                <el-table-column prop="allocation_number" label="归还单号" width="167"></el-table-column>
                                <el-table-column prop="type_name" label="款名" show-overflow-tooltip></el-table-column>
                                <el-table-column prop="sku_code" label="规格编码" width="140"></el-table-column>
                                <el-table-column prop="num" label="计划归还数" width="150">
                                    <template slot-scope="{row}">
                                        <span style="font-size: 16px;font-weight: bold">{{row.num}}</span>
                                    </template>
                                </el-table-column>
                                <el-table-column prop="actually_return_num" label="已归还数">
                                    <template slot-scope="{row}">
                                        <span style="font-size: 16px;font-weight: bold" :style="{color: row.actually_num==0?'#dcdee2':''}">{{row.actually_num}}</span>
                                    </template>
                                </el-table-column>
                                <el-table-column prop="adduser" label="发起人"></el-table-column>
                                <el-table-column prop="createtime" label="发起时间" width="135"></el-table-column>
                                <el-table-column prop="is_return" label="归还审核状态" width="120">
                                    <template slot-scope="{row}">
                                        <el-tag size="mini" v-if="row.status==-1" type="info">未发起</el-tag>
                                        <el-tag size="mini" v-else-if="row.status==0">审核中</el-tag>
                                        <el-tag size="mini" v-else-if="row.status==1" type="success">已通过</el-tag>
                                        <el-tag size="mini" v-else-if="row.status==2" type="danger">已拒绝</el-tag>
                                        <el-tag size="mini" v-else-if="row.status==3" type="warning">已撤销</el-tag>
                                        <el-tag size="mini" v-else>{{ row.status }}</el-tag>
                                    </template>
                                </el-table-column>
                            </el-table>
                        </el-tab-pane>
                    </el-tabs>
                </el-row>
            </el-row>
        </el-drawer>

        <!--详情(还)-->
        <el-drawer title="详情（归还）" :visible.sync="detailHVisible" size="1200px" direction="rtl" :wrapperClosable="false" :before-close="closeBtn">
            <el-row style="padding: 0 20px;">
                <el-row>
                    <span style="font-size: 18px;font-weight: bold;vertical-align: top;color: black;margin-right: 4px;">{{detail.allocation_number}}</span>
                    <el-tag size="small" v-if="detail.status==-1" type="info">未发起</el-tag>
                    <el-tag size="small" v-else-if="detail.status==0">审核中</el-tag>
                    <el-tag size="small" v-else-if="detail.status==1" type="success">已通过</el-tag>
                    <el-tag size="small" v-else-if="detail.status==2" type="danger">已拒绝</el-tag>
                    <el-tag size="small" v-else-if="detail.status==3" type="warning">已撤回</el-tag>
                    <el-tag size="small" v-else-if="detail.status==4" type="info">已撤销</el-tag>
                    <el-tag size="small" v-else>{{ detail.status }}</el-tag>
                    &nbsp;
                    <el-tag size="small" v-if="detail.data_return==0" type="info">未归还</el-tag>
                    <el-tag  effect="plain" size="small" v-else-if="detail.data_return==1" type="warning">部分归还</el-tag>
                    <el-tag size="small" v-else-if="detail.data_return==2" type="success">全部归还</el-tag>
                    <el-tag size="small" v-else>{{ detail.data_return }}</el-tag>
                    &nbsp;&nbsp;
                    <span style="color: #999;">发起人：{{detail.adduser}}</span>
                    &nbsp;&nbsp;
                    <span style="color: #999;">发起时间：{{detail.createtime}}</span>
                </el-row>
                <el-row style="font-size: 14px;margin-top: 10px;">
                    <el-col :span="2" style="font-size: 16px">
                        <span style="color: rgb(44, 112, 214)">归还</span> / <span :style="{color: detail.data_status==0 ? '#67C23A':'#ed4014'}">{{detail.data_status==0?"正常":"关闭"}}</span>
                    </el-col>
                    <el-col :span="18">
                        计划归还数 / 实际归还数：
                        <span style="font-weight: bold;font-size: 16px;">{{detail.plan_num}}</span> /
                        <span style="font-weight: bold;font-size: 16px;color: #ed4014">{{detail.actually_num}}</span>
                    </el-col>
                </el-row>
                <el-row style="font-size: 14px;margin-top: 10px">
                    <el-col :span="9">
                        <div style="display: inline-block;border: 1px solid rgb(45, 140, 240);width: 25px;height: 25px;line-height: 25px;text-align: center;border-radius: 20px;">邮</div>
                        运输方式：<span>{{detail.transport_type || "--"}}</span>&nbsp;&nbsp;
                        快递单号：<span>{{detail.ourier_number || "--"}}</span>
                    </el-col>
                    <el-col :span="15" style="color: #999;font-size:12px;">
                        <span>{{detail.wp_province+detail.wp_city+detail.wp_area+detail.wp_address}}</span>&nbsp;
                        <span>{{ detail.wp_user }}</span>&nbsp;
                        <span>{{ detail.wp_phone }}</span>
                    </el-col>
                </el-row>
                <el-row style="font-size: 14px;margin-top: 10px">
                    <div style="display: inline-block;border: 1px solid rgb(45, 140, 240);width: 25px;height: 25px;line-height: 25px;text-align: center;border-radius: 20px;">备</div>
                    <span>{{ detail.remark || "--" }}</span>&nbsp;&nbsp;
                    申请事由：<span>{{detail.reason}}</span>
                </el-row>
                <el-row style="margin-top: 20px">
                    <el-tabs type="border-card" v-model="tab">
                        <el-tab-pane label="归还列表" name="all">
                            <el-table :data="detailHList" style="width: 100%" :max-height="drawerTableHeight" v-loading="loading" size="mini">
                                <el-table-column prop="img" label="图片" width="50">
                                    <template slot-scope="{row}">
                                        <el-image :src="row.img" fit="contian" :preview-src-list="[row.img]">
                                            <div slot="error" class="image-slot">
                                                <svg t="1718681716906" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2623" width="20" height="20"><path d="M400.696 268.795c-17.249 0-31.233 13.986-31.233 31.233v30.471c0 17.249 13.986 31.233 31.233 31.233s31.233-13.986 31.233-31.233v-30.471c0-17.249-13.985-31.233-31.233-31.233z" fill="#999999" p-id="2624"></path><path d="M623.649 361.734c17.249 0 31.234-13.986 31.234-31.233v-30.471c0-17.249-13.986-31.233-31.234-31.233s-31.233 13.986-31.233 31.233v30.471c-0.001 17.248 13.985 31.233 31.233 31.233z" fill="#999999" p-id="2625"></path><path d="M438.295 388.804c-14.656 9.104-19.155 28.362-10.050 43.013 11.209 18.047 41.976 48.59 86.157 48.59 43.958 0 75.1-30.313 86.574-48.223 9.303-14.529 5.068-33.847-9.455-43.15-14.539-9.298-33.852-5.068-43.15 9.455-0.122 0.199-13.38 19.45-33.969 19.45-20.009 0-32.444-18.128-33.278-19.373-9.166-14.423-28.28-18.805-42.829-9.761z" fill="#999999" p-id="2626"></path><path d="M824.508503 116.690676 571.592236 116.690676c-17.248849 0-31.233352 13.985526-31.233352 31.233352s13.985526 31.233352 31.233352 31.233352l252.916267 0c40.181141 0 72.878844 32.692586 72.878844 72.878844l0 396.966057-189.334159-165.29465c-12.20088-10.655687-30.517037-10.207479-42.173518 0.9967L468.578048 674.16231 309.521472 517.519714c-11.895935-11.70253-30.903847-12.002358-43.154869-0.645706L126.957507 646.163629l0-394.126382c0-40.186258 32.692586-72.878844 72.878844-72.878844l252.916267 0c17.248849 0 31.233352-13.985526 31.233352-31.233352S470.000444 116.690676 452.751594 116.690676L199.836351 116.690676c-74.632791 0-135.346571 60.71378-135.346571 135.346571l0 520.56405c0 74.632791 60.71378 135.346571 135.346571 135.346571l252.916267 0c17.248849 0 31.233352-13.985526 31.233352-31.233352s-13.985526-31.233352-31.233352-31.233352L199.836351 845.481164c-40.186258 0-72.878844-32.692586-72.878844-72.878844l0-41.23924 160.003134-148.385539 159.428036 157.007917c12.048407 11.865235 31.361265 11.981892 43.546795 0.274246l198.576661-190.68697 208.876238 182.346001 0 40.683585c0 40.186258-32.697703 72.878844-72.878844 72.878844L571.592236 845.481164c-17.248849 0-31.233352 13.985526-31.233352 31.233352s13.985526 31.233352 31.233352 31.233352l252.916267 0c74.627674 0 135.346571-60.71378 135.346571-135.346571L959.855074 252.037247C959.855074 177.404456 899.136178 116.690676 824.508503 116.690676z" fill="#999999" p-id="2627"></path></svg>
                                            </div>
                                        </el-image>
                                    </template>
                                </el-table-column>
                                <el-table-column prop="allocation_number" label="归还单号" width="167"></el-table-column>
                                <el-table-column prop="type_name" label="款名" show-overflow-tooltip></el-table-column>
                                <el-table-column prop="sku_code" label="规格编码" width="140"></el-table-column>
                                <el-table-column prop="num" label="计划归还数" width="150">
                                    <template slot-scope="{row}">
                                        <span style="font-size: 16px;font-weight: bold">{{row.num}}</span>
                                    </template>
                                </el-table-column>
                                <el-table-column prop="actually_return_num" label="已归还数">
                                    <template slot-scope="{row}">
                                        <span style="font-size: 16px;font-weight: bold" :style="{color: row.actually_num==0?'#dcdee2':''}">{{row.actually_num}}</span>
                                    </template>
                                </el-table-column>
                                <el-table-column prop="adduser" label="发起人"></el-table-column>
                                <el-table-column prop="createtime" label="发起时间" width="135"></el-table-column>
                                <el-table-column prop="is_return" label="归还审核状态" width="120">
                                    <template slot-scope="{row}">
                                        <el-tag size="mini" v-if="row.status==-1" type="info">未发起</el-tag>
                                        <el-tag size="mini" v-else-if="row.status==0">审核中</el-tag>
                                        <el-tag size="mini" v-else-if="row.status==1" type="success">已通过</el-tag>
                                        <el-tag size="mini" v-else-if="row.status==2" type="danger">已拒绝</el-tag>
                                        <el-tag size="mini" v-else-if="row.status==3" type="warning">已撤销</el-tag>
                                        <el-tag size="mini" v-else>{{ row.status }}</el-tag>
                                    </template>
                                </el-table-column>
                            </el-table>
                        </el-tab-pane>
                    </el-tabs>
                </el-row>
            </el-row>
        </el-drawer>

        <!--详情(销)-->
        <el-drawer title="详情（销售）" :visible.sync="detailXVisible" size="1200px" direction="rtl" :wrapperClosable="false" :before-close="closeBtn">
            <el-row style="padding: 0 20px;">
                <el-row>
                    <span style="font-size: 18px;font-weight: bold;vertical-align: top;color: black;margin-right: 4px;">{{detail.allocation_number}}</span>
                    <el-tag size="small" v-if="detail.status==-1" type="info">未发起</el-tag>
                    <el-tag size="small" v-else-if="detail.status==0">审核中</el-tag>
                    <el-tag size="small" v-else-if="detail.status==1" type="success">已通过</el-tag>
                    <el-tag size="small" v-else-if="detail.status==2" type="danger">已拒绝</el-tag>
                    <el-tag size="small" v-else-if="detail.status==3" type="warning">已撤回</el-tag>
                    <el-tag size="small" v-else-if="detail.status==4" type="info">已撤销</el-tag>
                    <el-tag size="small" v-else>{{ detail.status }}</el-tag>
                    &nbsp;
                    <el-tag size="small" v-if="detail.data_return==0" type="info">未归还</el-tag>
                    <el-tag size="small" v-else-if="detail.data_return==1" type="warning">部分归还</el-tag>
                    <el-tag size="small" v-else-if="detail.data_return==2" type="success">全部归还</el-tag>
                    <el-tag size="small" v-else>{{ detail.data_return }}</el-tag>
                    &nbsp;&nbsp;
                    <span style="color: #999;">发起人：{{detail.adduser}}</span>
                    &nbsp;&nbsp;
                    <span style="color: #999;">发起时间：{{detail.createtime}}</span>
                </el-row>
                <el-row style="font-size: 14px;margin-top: 10px;">
                    <el-col :span="2" style="font-size: 16px">
                        <span style="color: rgb(44, 112, 214)">销售</span> / <span :style="{color: detail.data_status==0 ? '#67C23A':'#ed4014'}">{{detail.data_status==0?"正常":"关闭"}}</span>
                    </el-col>
                    <el-col :span="18">
                        计划销售数 / 实际销售数：
                        <span style="font-weight: bold;font-size: 16px;">{{detail.plan_num}}</span> /
                        <span style="font-weight: bold;font-size: 16px;color: #ed4014">{{detail.actually_num}}</span>&nbsp;&nbsp;&nbsp;
                        已归还数：<span style="font-weight: bold;font-size: 16px;color: #67C23A">{{detail.actually_return_num}}</span>&nbsp;&nbsp;&nbsp;
                        计划销售总价 / 实际销售总价：
                        <span style="font-weight: bold;font-size: 16px;">{{detail.plan_amount}}</span> /
                        <span style="font-weight: bold;font-size: 16px;color: #ed4014">{{detail.actually_amount}}</span>&nbsp;&nbsp;&nbsp;
                    </el-col>
                </el-row>
                <el-row style="font-size: 12px;margin-top: 10px">
                    <el-col :span="9">
                        <div style="display: inline-block;border: 1px solid rgb(45, 140, 240);width: 20px;height: 20px;line-height: 20px;text-align: center;border-radius: 20px;">邮</div>
                        运输方式：<span>{{detail.transport_type || "--"}}</span>&nbsp;&nbsp;
                        快递单号：<span>{{detail.courier_number || "--"}}</span>
                    </el-col>
                    <el-col :span="15" style="color: #999;font-size:12px;">
                        <span>{{detail.wp_province+detail.wp_city+detail.wp_area+detail.wp_address}}</span>&nbsp;
                        <span>{{ detail.wp_user }}</span>&nbsp;
                        <span>{{ detail.wp_phone }}</span>
                    </el-col>
                </el-row>
                <el-row style="font-size: 12px;margin-top: 10px">
                    <div style="display: inline-block;border: 1px solid rgb(45, 140, 240);width: 20px;height: 20px;line-height: 20px;text-align: center;border-radius: 20px;">备</div>
                    <span>{{ detail.remark || "--" }}</span>&nbsp;&nbsp;
                    申请事由：<span>{{detail.reason}}</span>
                </el-row>
                <el-row style="margin-top: 20px">
                    <el-tabs type="border-card" v-model="tab">
                        <el-tab-pane label="销售列表" name="all">
                            <el-button type="primary" size="mini" @click="openXReturnBtn" :disabled="detail.data_status==1 || selectedData.length==0">销售退货</el-button>
                            <el-table :data="detailXList" style="width: 100%" :max-height="drawerTableHeight2" v-loading="loading" size="mini"
                                      @selection-change="selectedTableBtn">
                                <el-table-column type="selection" width="55" :selectable="selectable"></el-table-column>
                                <el-table-column prop="img" label="图片" width="50">
                                    <template slot-scope="{row}">
                                        <el-image :src="row.img" fit="contian" :preview-src-list="[row.img]">
                                            <div slot="error" class="image-slot">
                                                <svg t="1718681716906" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2623" width="20" height="20"><path d="M400.696 268.795c-17.249 0-31.233 13.986-31.233 31.233v30.471c0 17.249 13.986 31.233 31.233 31.233s31.233-13.986 31.233-31.233v-30.471c0-17.249-13.985-31.233-31.233-31.233z" fill="#999999" p-id="2624"></path><path d="M623.649 361.734c17.249 0 31.234-13.986 31.234-31.233v-30.471c0-17.249-13.986-31.233-31.234-31.233s-31.233 13.986-31.233 31.233v30.471c-0.001 17.248 13.985 31.233 31.233 31.233z" fill="#999999" p-id="2625"></path><path d="M438.295 388.804c-14.656 9.104-19.155 28.362-10.050 43.013 11.209 18.047 41.976 48.59 86.157 48.59 43.958 0 75.1-30.313 86.574-48.223 9.303-14.529 5.068-33.847-9.455-43.15-14.539-9.298-33.852-5.068-43.15 9.455-0.122 0.199-13.38 19.45-33.969 19.45-20.009 0-32.444-18.128-33.278-19.373-9.166-14.423-28.28-18.805-42.829-9.761z" fill="#999999" p-id="2626"></path><path d="M824.508503 116.690676 571.592236 116.690676c-17.248849 0-31.233352 13.985526-31.233352 31.233352s13.985526 31.233352 31.233352 31.233352l252.916267 0c40.181141 0 72.878844 32.692586 72.878844 72.878844l0 396.966057-189.334159-165.29465c-12.20088-10.655687-30.517037-10.207479-42.173518 0.9967L468.578048 674.16231 309.521472 517.519714c-11.895935-11.70253-30.903847-12.002358-43.154869-0.645706L126.957507 646.163629l0-394.126382c0-40.186258 32.692586-72.878844 72.878844-72.878844l252.916267 0c17.248849 0 31.233352-13.985526 31.233352-31.233352S470.000444 116.690676 452.751594 116.690676L199.836351 116.690676c-74.632791 0-135.346571 60.71378-135.346571 135.346571l0 520.56405c0 74.632791 60.71378 135.346571 135.346571 135.346571l252.916267 0c17.248849 0 31.233352-13.985526 31.233352-31.233352s-13.985526-31.233352-31.233352-31.233352L199.836351 845.481164c-40.186258 0-72.878844-32.692586-72.878844-72.878844l0-41.23924 160.003134-148.385539 159.428036 157.007917c12.048407 11.865235 31.361265 11.981892 43.546795 0.274246l198.576661-190.68697 208.876238 182.346001 0 40.683585c0 40.186258-32.697703 72.878844-72.878844 72.878844L571.592236 845.481164c-17.248849 0-31.233352 13.985526-31.233352 31.233352s13.985526 31.233352 31.233352 31.233352l252.916267 0c74.627674 0 135.346571-60.71378 135.346571-135.346571L959.855074 252.037247C959.855074 177.404456 899.136178 116.690676 824.508503 116.690676z" fill="#999999" p-id="2627"></path></svg>
                                            </div>
                                        </el-image>
                                    </template>
                                </el-table-column>
                                <el-table-column prop="type_name" label="款名" show-overflow-tooltip></el-table-column>
                                <el-table-column prop="sku_code" label="规格编码" width="140"></el-table-column>
                                <el-table-column prop="num" label="计划销售/实际销售数量" width="150">
                                    <template slot-scope="{row}">
                                        <span style="font-size: 16px;font-weight: bold">{{row.num}}</span> /
                                        <span style="font-size: 16px;font-weight: bold;color: #ed4014">{{row.actually_num}}</span>
                                    </template>
                                </el-table-column>
                                <el-table-column prop="actually_return_num" label="已归还数">
                                    <template slot-scope="{row}">
                                        <span style="font-size: 16px;font-weight: bold" :style="{color: row.actually_return_num==0?'#dcdee2':''}">{{row.actually_return_num}}</span>
                                    </template>
                                </el-table-column>
                                <el-table-column prop="price" label="单价">
                                    <template slot-scope="{row}">
                                        <span style="font-size: 16px;font-weight: bold">{{row.price}}</span>
                                    </template>
                                </el-table-column>
                                <el-table-column prop="give_num" label="计划销售/实际销售总价" width="160">
                                    <template slot-scope="{row}">
                                        <span style="font-size: 16px;font-weight: bold">
                                            <span>{{parseFloat((Number(row.num) * Number(row.price)).toFixed(10))}}</span> /
                                            <span :style="{color: row.actually_num==0?'#dcdee2':'#ed4014'}">
                                                {{parseFloat(((Number(row.actually_num) - Number(row.actually_return_num)) * Number(row.price)).toFixed(10))}}
                                            </span>
                                        </span>
                                    </template>
                                </el-table-column>
                                <el-table-column prop="is_return" label="归还状态">
                                    <template slot-scope="{row}">
                                        <el-tag size="mini" v-if="row.is_return == 1" type="warning">部分归还</el-tag>
                                        <el-tag size="mini" v-else-if="row.is_return == 2" type="success">全部归还</el-tag>
                                        <el-tag size="mini" v-else type="info">未归还</el-tag>
                                    </template>
                                </el-table-column>
                            </el-table>
                        </el-tab-pane>
                        <el-tab-pane :label="'归还'+(detailHList.length==0 ?'':'：'+detailHList.length)" name="return">
                            <el-table :data="detailHList" style="width: 100%" :max-height="drawerTableHeight" v-loading="loading" size="mini">
                                <el-table-column prop="img" label="图片" width="50">
                                    <template slot-scope="{row}">
                                        <el-image :src="row.img" fit="contian" :preview-src-list="[row.img]">
                                            <div slot="error" class="image-slot">
                                                <svg t="1718681716906" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2623" width="20" height="20"><path d="M400.696 268.795c-17.249 0-31.233 13.986-31.233 31.233v30.471c0 17.249 13.986 31.233 31.233 31.233s31.233-13.986 31.233-31.233v-30.471c0-17.249-13.985-31.233-31.233-31.233z" fill="#999999" p-id="2624"></path><path d="M623.649 361.734c17.249 0 31.234-13.986 31.234-31.233v-30.471c0-17.249-13.986-31.233-31.234-31.233s-31.233 13.986-31.233 31.233v30.471c-0.001 17.248 13.985 31.233 31.233 31.233z" fill="#999999" p-id="2625"></path><path d="M438.295 388.804c-14.656 9.104-19.155 28.362-10.050 43.013 11.209 18.047 41.976 48.59 86.157 48.59 43.958 0 75.1-30.313 86.574-48.223 9.303-14.529 5.068-33.847-9.455-43.15-14.539-9.298-33.852-5.068-43.15 9.455-0.122 0.199-13.38 19.45-33.969 19.45-20.009 0-32.444-18.128-33.278-19.373-9.166-14.423-28.28-18.805-42.829-9.761z" fill="#999999" p-id="2626"></path><path d="M824.508503 116.690676 571.592236 116.690676c-17.248849 0-31.233352 13.985526-31.233352 31.233352s13.985526 31.233352 31.233352 31.233352l252.916267 0c40.181141 0 72.878844 32.692586 72.878844 72.878844l0 396.966057-189.334159-165.29465c-12.20088-10.655687-30.517037-10.207479-42.173518 0.9967L468.578048 674.16231 309.521472 517.519714c-11.895935-11.70253-30.903847-12.002358-43.154869-0.645706L126.957507 646.163629l0-394.126382c0-40.186258 32.692586-72.878844 72.878844-72.878844l252.916267 0c17.248849 0 31.233352-13.985526 31.233352-31.233352S470.000444 116.690676 452.751594 116.690676L199.836351 116.690676c-74.632791 0-135.346571 60.71378-135.346571 135.346571l0 520.56405c0 74.632791 60.71378 135.346571 135.346571 135.346571l252.916267 0c17.248849 0 31.233352-13.985526 31.233352-31.233352s-13.985526-31.233352-31.233352-31.233352L199.836351 845.481164c-40.186258 0-72.878844-32.692586-72.878844-72.878844l0-41.23924 160.003134-148.385539 159.428036 157.007917c12.048407 11.865235 31.361265 11.981892 43.546795 0.274246l198.576661-190.68697 208.876238 182.346001 0 40.683585c0 40.186258-32.697703 72.878844-72.878844 72.878844L571.592236 845.481164c-17.248849 0-31.233352 13.985526-31.233352 31.233352s13.985526 31.233352 31.233352 31.233352l252.916267 0c74.627674 0 135.346571-60.71378 135.346571-135.346571L959.855074 252.037247C959.855074 177.404456 899.136178 116.690676 824.508503 116.690676z" fill="#999999" p-id="2627"></path></svg>
                                            </div>
                                        </el-image>
                                    </template>
                                </el-table-column>
                                <el-table-column prop="allocation_number" label="归还单号" width="167"></el-table-column>
                                <el-table-column prop="type_name" label="款名" show-overflow-tooltip></el-table-column>
                                <el-table-column prop="sku_code" label="规格编码" width="140"></el-table-column>
                                <el-table-column prop="num" label="计划归还数" width="150">
                                    <template slot-scope="{row}">
                                        <span style="font-size: 16px;font-weight: bold">{{row.num}}</span>
                                    </template>
                                </el-table-column>
                                <el-table-column prop="actually_return_num" label="已归还数">
                                    <template slot-scope="{row}">
                                        <span style="font-size: 16px;font-weight: bold" :style="{color: row.actually_num==0?'#dcdee2':''}">{{row.actually_num}}</span>
                                    </template>
                                </el-table-column>
                                <el-table-column prop="adduser" label="发起人"></el-table-column>
                                <el-table-column prop="createtime" label="发起时间" width="135"></el-table-column>
                                <el-table-column prop="is_return" label="归还审核状态" width="120">
                                    <template slot-scope="{row}">
                                        <el-tag size="mini" v-if="row.status==-1" type="info">未发起</el-tag>
                                        <el-tag size="mini" v-else-if="row.status==0">审核中</el-tag>
                                        <el-tag size="mini" v-else-if="row.status==1" type="success">已通过</el-tag>
                                        <el-tag size="mini" v-else-if="row.status==2" type="danger">已拒绝</el-tag>
                                        <el-tag size="mini" v-else-if="row.status==3" type="warning">已撤销</el-tag>
                                        <el-tag size="mini" v-else>{{ row.status }}</el-tag>
                                    </template>
                                </el-table-column>
                            </el-table>
                        </el-tab-pane>
                    </el-tabs>
                </el-row>
            </el-row>
        </el-drawer>

        <!--归还所选-->
        <el-dialog title="归还确认" :visible.sync="returnVisible" :close-on-click-modal="false" :close-on-press-escape="false" top="2%" width="1000px">
            <el-row>
                <el-table :data="selectedData" style="width: 100%" max-height="350px" v-loading="loading" size="mini">
                    <el-table-column prop="img" label="图片" width="50">
                        <template slot-scope="{row}">
                            <el-image :src="row.img" fit="contian" :preview-src-list="[row.img]">
                                <div slot="error" class="image-slot">
                                    <svg t="1718681716906" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2623" width="20" height="20"><path d="M400.696 268.795c-17.249 0-31.233 13.986-31.233 31.233v30.471c0 17.249 13.986 31.233 31.233 31.233s31.233-13.986 31.233-31.233v-30.471c0-17.249-13.985-31.233-31.233-31.233z" fill="#999999" p-id="2624"></path><path d="M623.649 361.734c17.249 0 31.234-13.986 31.234-31.233v-30.471c0-17.249-13.986-31.233-31.234-31.233s-31.233 13.986-31.233 31.233v30.471c-0.001 17.248 13.985 31.233 31.233 31.233z" fill="#999999" p-id="2625"></path><path d="M438.295 388.804c-14.656 9.104-19.155 28.362-10.050 43.013 11.209 18.047 41.976 48.59 86.157 48.59 43.958 0 75.1-30.313 86.574-48.223 9.303-14.529 5.068-33.847-9.455-43.15-14.539-9.298-33.852-5.068-43.15 9.455-0.122 0.199-13.38 19.45-33.969 19.45-20.009 0-32.444-18.128-33.278-19.373-9.166-14.423-28.28-18.805-42.829-9.761z" fill="#999999" p-id="2626"></path><path d="M824.508503 116.690676 571.592236 116.690676c-17.248849 0-31.233352 13.985526-31.233352 31.233352s13.985526 31.233352 31.233352 31.233352l252.916267 0c40.181141 0 72.878844 32.692586 72.878844 72.878844l0 396.966057-189.334159-165.29465c-12.20088-10.655687-30.517037-10.207479-42.173518 0.9967L468.578048 674.16231 309.521472 517.519714c-11.895935-11.70253-30.903847-12.002358-43.154869-0.645706L126.957507 646.163629l0-394.126382c0-40.186258 32.692586-72.878844 72.878844-72.878844l252.916267 0c17.248849 0 31.233352-13.985526 31.233352-31.233352S470.000444 116.690676 452.751594 116.690676L199.836351 116.690676c-74.632791 0-135.346571 60.71378-135.346571 135.346571l0 520.56405c0 74.632791 60.71378 135.346571 135.346571 135.346571l252.916267 0c17.248849 0 31.233352-13.985526 31.233352-31.233352s-13.985526-31.233352-31.233352-31.233352L199.836351 845.481164c-40.186258 0-72.878844-32.692586-72.878844-72.878844l0-41.23924 160.003134-148.385539 159.428036 157.007917c12.048407 11.865235 31.361265 11.981892 43.546795 0.274246l198.576661-190.68697 208.876238 182.346001 0 40.683585c0 40.186258-32.697703 72.878844-72.878844 72.878844L571.592236 845.481164c-17.248849 0-31.233352 13.985526-31.233352 31.233352s13.985526 31.233352 31.233352 31.233352l252.916267 0c74.627674 0 135.346571-60.71378 135.346571-135.346571L959.855074 252.037247C959.855074 177.404456 899.136178 116.690676 824.508503 116.690676z" fill="#999999" p-id="2627"></path></svg>
                                </div>
                            </el-image>
                        </template>
                    </el-table-column>
                    <el-table-column prop="type_name" label="款名" show-overflow-tooltip></el-table-column>
                    <el-table-column prop="sku_code" label="规格编码" width="140"></el-table-column>
                    <el-table-column prop="num" label="计划借出/实际借出数量" width="150">
                        <template slot-scope="{row}">
                            <span style="font-size: 16px;font-weight: bold">{{row.num}}</span> /
                            <span style="font-size: 16px;font-weight: bold;color: #ed4014">{{row.actually_num}}</span>
                        </template>
                    </el-table-column>
                    <el-table-column prop="actually_return_num" label="已归还数">
                        <template slot-scope="{row}">
                            <span style="font-size: 16px;font-weight: bold" :style="{color: row.actually_return_num==0?'#dcdee2':''}">{{row.actually_return_num}}</span>
                        </template>
                    </el-table-column>
                    <el-table-column prop="ipurchase_num" label="已转内购数">
                        <template slot-scope="{row}">
                            <span style="font-size: 16px;font-weight: bold" :style="{color: row.ipurchase_num==0?'#dcdee2':''}">{{row.ipurchase_num}}</span>
                        </template>
                    </el-table-column>
                    <el-table-column prop="give_num" label="已转赠送数">
                        <template slot-scope="{row}">
                            <span style="font-size: 16px;font-weight: bold" :style="{color: row.give_num==0?'#dcdee2':''}">{{row.give_num}}</span>
                        </template>
                    </el-table-column>
                    <el-table-column prop="sale_num" label="已转销售数">
                        <template slot-scope="{row}">
                            <span style="font-size: 16px;font-weight: bold" :style="{color: row.sale_num==0?'#dcdee2':''}">{{row.sale_num}}</span>
                        </template>
                    </el-table-column>
                    <el-table-column prop="plan_return_num" label="计划归还数量">
                        <template slot-scope="{row}">
                            <el-input size="mini" v-model="row.plan_return_num" type="number" placeholder="归还数量"></el-input>
                        </template>
                    </el-table-column>
                </el-table>
                <div style="margin-top: 10px">
                    <svg t="1717659283335" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9445" width="16" height="16"><path d="M407.466667 477.866667h-277.333334C93.866667 477.866667 64 448 64 409.6v-277.333333c0-36.266667 29.866667-66.133333 66.133333-66.133334h277.333334c36.266667 0 66.133333 29.866667 66.133333 66.133334v277.333333c2.133333 38.4-27.733333 68.266667-66.133333 68.266667zM132.266667 108.8c-12.8 0-25.6 10.666667-25.6 25.6v277.333333c0 12.8 10.666667 25.6 25.6 25.6h277.333333c12.8 0 25.6-10.666667 25.6-25.6v-277.333333c0-12.8-10.666667-25.6-25.6-25.6h-277.333333zM407.466667 960h-277.333334C93.866667 960 64 930.133333 64 893.866667v-277.333334c0-36.266667 29.866667-66.133333 66.133333-66.133333h277.333334c36.266667 0 66.133333 29.866667 66.133333 66.133333v277.333334c2.133333 36.266667-27.733333 66.133333-66.133333 66.133333zM132.266667 590.933333c-12.8 0-25.6 10.666667-25.6 25.6v277.333334c0 12.8 10.666667 25.6 25.6 25.6h277.333333c12.8 0 25.6-10.666667 25.6-25.6v-277.333334c0-12.8-10.666667-25.6-25.6-25.6h-277.333333z m618.666666-110.933333c-17.066667 0-34.133333-6.4-46.933333-19.2L563.2 320c-12.8-12.8-19.2-29.866667-19.2-46.933333s6.4-34.133333 19.2-46.933334L704 83.2c12.8-12.8 29.866667-19.2 46.933333-19.2 17.066667 0 34.133333 6.4 46.933334 19.2l140.8 140.8c12.8 12.8 19.2 29.866667 19.2 46.933333 0 17.066667-6.4 34.133333-19.2 46.933334l-138.666667 142.933333c-12.8 12.8-29.866667 19.2-49.066667 19.2z m0-373.333333c-6.4 0-12.8 2.133333-17.066666 6.4l-140.8 140.8c-4.266667 4.266667-6.4 10.666667-6.4 17.066666 0 6.4 2.133333 12.8 6.4 17.066667l140.8 140.8c4.266667 4.266667 10.666667 6.4 17.066666 6.4 6.4 0 12.8-2.133333 17.066667-6.4l140.8-140.8c4.266667-4.266667 6.4-10.666667 6.4-17.066667 0-6.4-2.133333-12.8-6.4-17.066666L768 113.066667c-4.266667-4.266667-8.533333-6.4-17.066667-6.4z m138.666667 853.333333h-277.333333c-36.266667 0-66.133333-29.866667-66.133334-66.133333v-277.333334c0-36.266667 29.866667-66.133333 66.133334-66.133333h277.333333c36.266667 0 66.133333 29.866667 66.133333 66.133333v277.333334c2.133333 36.266667-27.733333 66.133333-66.133333 66.133333zM614.4 590.933333c-12.8 0-25.6 10.666667-25.6 25.6v277.333334c0 12.8 10.666667 25.6 25.6 25.6h277.333333c12.8 0 25.6-10.666667 25.6-25.6v-277.333334c0-12.8-10.666667-25.6-25.6-25.6h-277.333333z" fill="#1E87EB" p-id="9446"></path></svg>
                    <span style="font-size: 16px;font-weight: bold;vertical-align: bottom;margin-left: 4px;">邮寄信息</span>
                </div>
                <el-form :model="returnForm" :rules="rules" inline label-width="100px">
                    <el-form-item label="快递单号" prop="ourier_number">
                        <el-input size="small" v-model.trim="returnForm.ourier_number" placeholder="快递单号, 仅限一个" clearable></el-input>
                    </el-form-item>
                    <el-form-item label="运输方式" prop="logistics_code">
                        <el-select size="small" v-model="returnForm.logistics_code">
                            <el-option v-for="(item, index) in logistics.list" :key="index" :label="item.name" :value="item.code"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="联系人" prop="wp_user">
                        <el-input size="small" v-model.trim="returnForm.wp_user" clearable></el-input>
                    </el-form-item>
                    <el-form-item label="联系电话" prop="wp_phone">
                        <el-input size="small" v-model.trim="returnForm.wp_phone" clearable></el-input>
                    </el-form-item>
                    <el-form-item label="邮寄地址" prop="wp_address">
                        <el-input size="small" v-model.trim="returnForm.wp_address" style="width: 540px;" clearable></el-input>
                    </el-form-item>
                    <el-form-item label="备注">
                        <el-input size="small" type="textarea" style="width: 540px;" v-model.trim="returnForm.remark" clearable></el-input>
                    </el-form-item>
                </el-form>
            </el-row>
            <div slot="footer">
                <el-button @click="returnVisible=false" size="small" plain>退 出</el-button>
                <el-button type="primary" @click="returnSubmitBtn" size="small" :loading="saveLoading" :disabled="!returnForm.ourier_number">确 定</el-button>
            </div>
        </el-dialog>

        <!--销售退货-->
        <el-dialog title="销售退货" :visible.sync="returnXVisible" :close-on-click-modal="false" :close-on-press-escape="false" top="2%" width="1000px">
            <el-row>
                <el-table :data="selectedData" style="width: 100%" max-height="350px" v-loading="loading" size="mini">
                    <el-table-column prop="img" label="图片" width="50">
                        <template slot-scope="{row}">
                            <el-image :src="row.img" fit="contian" :preview-src-list="[row.img]">
                                <div slot="error" class="image-slot">
                                    <svg t="1718681716906" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2623" width="20" height="20"><path d="M400.696 268.795c-17.249 0-31.233 13.986-31.233 31.233v30.471c0 17.249 13.986 31.233 31.233 31.233s31.233-13.986 31.233-31.233v-30.471c0-17.249-13.985-31.233-31.233-31.233z" fill="#999999" p-id="2624"></path><path d="M623.649 361.734c17.249 0 31.234-13.986 31.234-31.233v-30.471c0-17.249-13.986-31.233-31.234-31.233s-31.233 13.986-31.233 31.233v30.471c-0.001 17.248 13.985 31.233 31.233 31.233z" fill="#999999" p-id="2625"></path><path d="M438.295 388.804c-14.656 9.104-19.155 28.362-10.050 43.013 11.209 18.047 41.976 48.59 86.157 48.59 43.958 0 75.1-30.313 86.574-48.223 9.303-14.529 5.068-33.847-9.455-43.15-14.539-9.298-33.852-5.068-43.15 9.455-0.122 0.199-13.38 19.45-33.969 19.45-20.009 0-32.444-18.128-33.278-19.373-9.166-14.423-28.28-18.805-42.829-9.761z" fill="#999999" p-id="2626"></path><path d="M824.508503 116.690676 571.592236 116.690676c-17.248849 0-31.233352 13.985526-31.233352 31.233352s13.985526 31.233352 31.233352 31.233352l252.916267 0c40.181141 0 72.878844 32.692586 72.878844 72.878844l0 396.966057-189.334159-165.29465c-12.20088-10.655687-30.517037-10.207479-42.173518 0.9967L468.578048 674.16231 309.521472 517.519714c-11.895935-11.70253-30.903847-12.002358-43.154869-0.645706L126.957507 646.163629l0-394.126382c0-40.186258 32.692586-72.878844 72.878844-72.878844l252.916267 0c17.248849 0 31.233352-13.985526 31.233352-31.233352S470.000444 116.690676 452.751594 116.690676L199.836351 116.690676c-74.632791 0-135.346571 60.71378-135.346571 135.346571l0 520.56405c0 74.632791 60.71378 135.346571 135.346571 135.346571l252.916267 0c17.248849 0 31.233352-13.985526 31.233352-31.233352s-13.985526-31.233352-31.233352-31.233352L199.836351 845.481164c-40.186258 0-72.878844-32.692586-72.878844-72.878844l0-41.23924 160.003134-148.385539 159.428036 157.007917c12.048407 11.865235 31.361265 11.981892 43.546795 0.274246l198.576661-190.68697 208.876238 182.346001 0 40.683585c0 40.186258-32.697703 72.878844-72.878844 72.878844L571.592236 845.481164c-17.248849 0-31.233352 13.985526-31.233352 31.233352s13.985526 31.233352 31.233352 31.233352l252.916267 0c74.627674 0 135.346571-60.71378 135.346571-135.346571L959.855074 252.037247C959.855074 177.404456 899.136178 116.690676 824.508503 116.690676z" fill="#999999" p-id="2627"></path></svg>
                                </div>
                            </el-image>
                        </template>
                    </el-table-column>
                    <el-table-column prop="type_name" label="款名" show-overflow-tooltip></el-table-column>
                    <el-table-column prop="sku_code" label="规格编码" width="140"></el-table-column>
                    <el-table-column prop="num" label="计划销售/实际销售数量" width="150">
                        <template slot-scope="{row}">
                            <span style="font-size: 16px;font-weight: bold">{{row.num}}</span> /
                            <span style="font-size: 16px;font-weight: bold;color: #ed4014">{{row.actually_num}}</span>
                        </template>
                    </el-table-column>
                    <el-table-column prop="actually_return_num" label="已归还数">
                        <template slot-scope="{row}">
                            <span style="font-size: 16px;font-weight: bold" :style="{color: row.actually_return_num==0?'#dcdee2':''}">{{row.actually_return_num}}</span>
                        </template>
                    </el-table-column>
                    <el-table-column prop="price" label="价格">
                        <template slot-scope="{row}">
                            <span style="font-size: 16px;font-weight: bold" :style="{color: !row.price ? '#dcdee2':''}">{{row.price}}</span>
                        </template>
                    </el-table-column>
                    <el-table-column prop="plan_return_num" label="计划归还数量">
                        <template slot-scope="{row}">
                            <el-input size="mini" v-model="row.plan_return_num" type="number" placeholder="归还数量"></el-input>
                        </template>
                    </el-table-column>
                </el-table>
                <div style="margin-top: 10px">
                    <svg t="1717659283335" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9445" width="16" height="16"><path d="M407.466667 477.866667h-277.333334C93.866667 477.866667 64 448 64 409.6v-277.333333c0-36.266667 29.866667-66.133333 66.133333-66.133334h277.333334c36.266667 0 66.133333 29.866667 66.133333 66.133334v277.333333c2.133333 38.4-27.733333 68.266667-66.133333 68.266667zM132.266667 108.8c-12.8 0-25.6 10.666667-25.6 25.6v277.333333c0 12.8 10.666667 25.6 25.6 25.6h277.333333c12.8 0 25.6-10.666667 25.6-25.6v-277.333333c0-12.8-10.666667-25.6-25.6-25.6h-277.333333zM407.466667 960h-277.333334C93.866667 960 64 930.133333 64 893.866667v-277.333334c0-36.266667 29.866667-66.133333 66.133333-66.133333h277.333334c36.266667 0 66.133333 29.866667 66.133333 66.133333v277.333334c2.133333 36.266667-27.733333 66.133333-66.133333 66.133333zM132.266667 590.933333c-12.8 0-25.6 10.666667-25.6 25.6v277.333334c0 12.8 10.666667 25.6 25.6 25.6h277.333333c12.8 0 25.6-10.666667 25.6-25.6v-277.333334c0-12.8-10.666667-25.6-25.6-25.6h-277.333333z m618.666666-110.933333c-17.066667 0-34.133333-6.4-46.933333-19.2L563.2 320c-12.8-12.8-19.2-29.866667-19.2-46.933333s6.4-34.133333 19.2-46.933334L704 83.2c12.8-12.8 29.866667-19.2 46.933333-19.2 17.066667 0 34.133333 6.4 46.933334 19.2l140.8 140.8c12.8 12.8 19.2 29.866667 19.2 46.933333 0 17.066667-6.4 34.133333-19.2 46.933334l-138.666667 142.933333c-12.8 12.8-29.866667 19.2-49.066667 19.2z m0-373.333333c-6.4 0-12.8 2.133333-17.066666 6.4l-140.8 140.8c-4.266667 4.266667-6.4 10.666667-6.4 17.066666 0 6.4 2.133333 12.8 6.4 17.066667l140.8 140.8c4.266667 4.266667 10.666667 6.4 17.066666 6.4 6.4 0 12.8-2.133333 17.066667-6.4l140.8-140.8c4.266667-4.266667 6.4-10.666667 6.4-17.066667 0-6.4-2.133333-12.8-6.4-17.066666L768 113.066667c-4.266667-4.266667-8.533333-6.4-17.066667-6.4z m138.666667 853.333333h-277.333333c-36.266667 0-66.133333-29.866667-66.133334-66.133333v-277.333334c0-36.266667 29.866667-66.133333 66.133334-66.133333h277.333333c36.266667 0 66.133333 29.866667 66.133333 66.133333v277.333334c2.133333 36.266667-27.733333 66.133333-66.133333 66.133333zM614.4 590.933333c-12.8 0-25.6 10.666667-25.6 25.6v277.333334c0 12.8 10.666667 25.6 25.6 25.6h277.333333c12.8 0 25.6-10.666667 25.6-25.6v-277.333334c0-12.8-10.666667-25.6-25.6-25.6h-277.333333z" fill="#1E87EB" p-id="9446"></path></svg>
                    <span style="font-size: 16px;font-weight: bold;vertical-align: bottom;margin-left: 4px;">邮寄信息</span>
                </div>
                <el-form :model="returnForm" :rules="rules" inline label-width="100px">
                    <el-form-item label="快递单号" prop="ourier_number">
                        <el-input size="small" v-model.trim="returnForm.ourier_number" placeholder="快递单号, 仅限一个" clearable></el-input>
                    </el-form-item>
                    <el-form-item label="运输方式" prop="logistics_code">
                        <el-select size="small" v-model="returnForm.logistics_code">
                            <el-option v-for="(item, index) in logistics.list" :key="index" :label="item.name" :value="item.code"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="联系人" prop="wp_user">
                        <el-input size="small" v-model.trim="returnForm.wp_user" clearable></el-input>
                    </el-form-item>
                    <el-form-item label="联系电话" prop="wp_phone">
                        <el-input size="small" v-model.trim="returnForm.wp_phone" clearable></el-input>
                    </el-form-item>
                    <el-form-item label="邮寄地址" prop="wp_address">
                        <el-input size="small" v-model.trim="returnForm.wp_address" style="width: 540px;" clearable></el-input>
                    </el-form-item>
                    <el-form-item label="备注">
                        <el-input size="small" type="textarea" style="width: 540px;" v-model.trim="returnForm.remark" clearable></el-input>
                    </el-form-item>
                </el-form>
            </el-row>
            <div slot="footer">
                <el-button @click="returnXVisible=false" size="small" plain>退 出</el-button>
                <el-button type="primary" @click="returnSubmitBtn" size="small" :loading="saveLoading" :disabled="!returnForm.ourier_number">确 定</el-button>
            </div>
        </el-dialog>

        <!--未归还转内购-->
        <el-dialog title="商品转内购" :visible.sync="ipurchaseLendVisible" :close-on-click-modal="false" :close-on-press-escape="false" top="2%" width="1000px">
            <el-row v-if="step==1">
                <el-table :data="selectedData" style="width: 100%" max-height="350px" v-loading="loading" size="mini">
                    <el-table-column prop="img" label="图片" width="50">
                        <template slot-scope="{row}">
                            <el-image :src="row.img" fit="contian" :preview-src-list="[row.img]">
                                <div slot="error" class="image-slot">
                                    <svg t="1718681716906" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2623" width="20" height="20"><path d="M400.696 268.795c-17.249 0-31.233 13.986-31.233 31.233v30.471c0 17.249 13.986 31.233 31.233 31.233s31.233-13.986 31.233-31.233v-30.471c0-17.249-13.985-31.233-31.233-31.233z" fill="#999999" p-id="2624"></path><path d="M623.649 361.734c17.249 0 31.234-13.986 31.234-31.233v-30.471c0-17.249-13.986-31.233-31.234-31.233s-31.233 13.986-31.233 31.233v30.471c-0.001 17.248 13.985 31.233 31.233 31.233z" fill="#999999" p-id="2625"></path><path d="M438.295 388.804c-14.656 9.104-19.155 28.362-10.050 43.013 11.209 18.047 41.976 48.59 86.157 48.59 43.958 0 75.1-30.313 86.574-48.223 9.303-14.529 5.068-33.847-9.455-43.15-14.539-9.298-33.852-5.068-43.15 9.455-0.122 0.199-13.38 19.45-33.969 19.45-20.009 0-32.444-18.128-33.278-19.373-9.166-14.423-28.28-18.805-42.829-9.761z" fill="#999999" p-id="2626"></path><path d="M824.508503 116.690676 571.592236 116.690676c-17.248849 0-31.233352 13.985526-31.233352 31.233352s13.985526 31.233352 31.233352 31.233352l252.916267 0c40.181141 0 72.878844 32.692586 72.878844 72.878844l0 396.966057-189.334159-165.29465c-12.20088-10.655687-30.517037-10.207479-42.173518 0.9967L468.578048 674.16231 309.521472 517.519714c-11.895935-11.70253-30.903847-12.002358-43.154869-0.645706L126.957507 646.163629l0-394.126382c0-40.186258 32.692586-72.878844 72.878844-72.878844l252.916267 0c17.248849 0 31.233352-13.985526 31.233352-31.233352S470.000444 116.690676 452.751594 116.690676L199.836351 116.690676c-74.632791 0-135.346571 60.71378-135.346571 135.346571l0 520.56405c0 74.632791 60.71378 135.346571 135.346571 135.346571l252.916267 0c17.248849 0 31.233352-13.985526 31.233352-31.233352s-13.985526-31.233352-31.233352-31.233352L199.836351 845.481164c-40.186258 0-72.878844-32.692586-72.878844-72.878844l0-41.23924 160.003134-148.385539 159.428036 157.007917c12.048407 11.865235 31.361265 11.981892 43.546795 0.274246l198.576661-190.68697 208.876238 182.346001 0 40.683585c0 40.186258-32.697703 72.878844-72.878844 72.878844L571.592236 845.481164c-17.248849 0-31.233352 13.985526-31.233352 31.233352s13.985526 31.233352 31.233352 31.233352l252.916267 0c74.627674 0 135.346571-60.71378 135.346571-135.346571L959.855074 252.037247C959.855074 177.404456 899.136178 116.690676 824.508503 116.690676z" fill="#999999" p-id="2627"></path></svg>
                                </div>
                            </el-image>
                        </template>
                    </el-table-column>
                    <el-table-column prop="type_name" label="款名" show-overflow-tooltip></el-table-column>
                    <el-table-column prop="sku_code" label="规格编码" width="140"></el-table-column>
                    <el-table-column prop="num" label="计划借出/实际借出数量" width="150">
                        <template slot-scope="{row}">
                            <span style="font-size: 16px;font-weight: bold">{{row.num}}</span> /
                            <span style="font-size: 16px;font-weight: bold;color: #ed4014">{{row.actually_num}}</span>
                        </template>
                    </el-table-column>
                    <el-table-column prop="actually_buy_num" label="可内购数量" width="120">
                        <template slot-scope="{row}">
                            <span style="font-size: 16px;font-weight: bold" :style="{color: row.actually_buy_num==0?'#dcdee2':''}">{{row.actually_buy_num}}</span>
                        </template>
                    </el-table-column>
                    <el-table-column prop="price" label="单价">
                        <template slot-scope="{row}">
                            <el-input type="number" v-model="row.price" placeholder="请输入单价" size="mini"></el-input>
                        </template>
                    </el-table-column>
                    <el-table-column prop="plan_give_num" label="计划内购数量">
                        <template slot-scope="{row}">
                            <el-input size="mini" v-model="row.plan_buy_num" type="number" placeholder="内购数量"></el-input>
                        </template>
                    </el-table-column>
                </el-table>
                <el-col :span="24" style="margin-top: 10px;">
                    <span>商品折扣：</span>
                    <el-input v-model="discount" placeholder="请输入折扣" type="number" size="mini" style="width: 100px"></el-input>（折）
                </el-col>
            </el-row>
            <el-row v-else>
                <el-col :span="24" style="background-color: aliceblue;font-size: 14px;padding: 10px 20px;">
                    <div style="font-weight: bold">重要提示：</div>
                    <p style="color: #ff7171">内购打款请汇入正确银行账户，具体信息见下方备注！</p>
                </el-col>
                <el-col :span="24" style="background-color: aliceblue;font-size: 14px;margin-top: 10px;padding: 10px 20px;">
                    <div>注：</div>
                    <div style="padding-left: 18px;">
                        <p>1、试用期员工转正后享受内购福利；</p>
                        <p>2、正式员工享受每月一套的福利，发货优先客户订单；</p>
                        <p>3、内购可换尺码，不可退；</p>
                        <p v-if="detail.is_subject == 'kz'">
                            4、十三余收款为&nbsp;&nbsp;
                            <span style="color: #2d8cf0">
                                <span>户名：年年有余 (浙江)文化科技有限公司</span>&nbsp;&nbsp;
                                <span>开户行：杭州联合银行九堡支行</span>&nbsp;&nbsp;
                                <span>账号：201000242198455</span>
                            </span>
                        </p>
                        <p v-if="detail.is_subject == 'mz'">
                            4、妙哉收款为&nbsp;&nbsp;
                            <span style="color: #2d8cf0">
                                <span>户名：杭州妙哉文化有限公司</span>&nbsp;&nbsp;
                                <span>开户行：上海浦东发展银行杭州分行营业部</span>&nbsp;&nbsp;
                                <span>账号：95200078801000002375</span>
                            </span>
                        </p>
                        <p v-if="detail.is_subject == 'yx'">
                            4、有香如故收款为&nbsp;&nbsp;
                            <span style="color: #2d8cf0">
                                <span>户名：杭州著风和雨文化科技有限公司</span>&nbsp;&nbsp;
                                <span>开户行：中国民生银行杭州庆春支行</span>&nbsp;&nbsp;
                                <span>账号：638836502</span>
                            </span>
                        </p>
                        <p v-if="detail.is_subject == 'qyx'">
                            4、七月夕收款为&nbsp;&nbsp;
                            <span style="color: #2d8cf0">
                                <span>户名：杭州汉夕互联网科技有限公司</span>&nbsp;&nbsp;
                                <span>开户行：杭州联合银行九堡支行</span>&nbsp;&nbsp;
                                <span>账号：201000305214608</span>
                            </span>
                        </p>
                    </div>
                </el-col>
                <el-col :span="24" style="margin-top: 10px">
                    <div style="margin-top: 10px">
                        <svg t="1717659283335" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9445" width="16" height="16"><path d="M407.466667 477.866667h-277.333334C93.866667 477.866667 64 448 64 409.6v-277.333333c0-36.266667 29.866667-66.133333 66.133333-66.133334h277.333334c36.266667 0 66.133333 29.866667 66.133333 66.133334v277.333333c2.133333 38.4-27.733333 68.266667-66.133333 68.266667zM132.266667 108.8c-12.8 0-25.6 10.666667-25.6 25.6v277.333333c0 12.8 10.666667 25.6 25.6 25.6h277.333333c12.8 0 25.6-10.666667 25.6-25.6v-277.333333c0-12.8-10.666667-25.6-25.6-25.6h-277.333333zM407.466667 960h-277.333334C93.866667 960 64 930.133333 64 893.866667v-277.333334c0-36.266667 29.866667-66.133333 66.133333-66.133333h277.333334c36.266667 0 66.133333 29.866667 66.133333 66.133333v277.333334c2.133333 36.266667-27.733333 66.133333-66.133333 66.133333zM132.266667 590.933333c-12.8 0-25.6 10.666667-25.6 25.6v277.333334c0 12.8 10.666667 25.6 25.6 25.6h277.333333c12.8 0 25.6-10.666667 25.6-25.6v-277.333334c0-12.8-10.666667-25.6-25.6-25.6h-277.333333z m618.666666-110.933333c-17.066667 0-34.133333-6.4-46.933333-19.2L563.2 320c-12.8-12.8-19.2-29.866667-19.2-46.933333s6.4-34.133333 19.2-46.933334L704 83.2c12.8-12.8 29.866667-19.2 46.933333-19.2 17.066667 0 34.133333 6.4 46.933334 19.2l140.8 140.8c12.8 12.8 19.2 29.866667 19.2 46.933333 0 17.066667-6.4 34.133333-19.2 46.933334l-138.666667 142.933333c-12.8 12.8-29.866667 19.2-49.066667 19.2z m0-373.333333c-6.4 0-12.8 2.133333-17.066666 6.4l-140.8 140.8c-4.266667 4.266667-6.4 10.666667-6.4 17.066666 0 6.4 2.133333 12.8 6.4 17.066667l140.8 140.8c4.266667 4.266667 10.666667 6.4 17.066666 6.4 6.4 0 12.8-2.133333 17.066667-6.4l140.8-140.8c4.266667-4.266667 6.4-10.666667 6.4-17.066667 0-6.4-2.133333-12.8-6.4-17.066666L768 113.066667c-4.266667-4.266667-8.533333-6.4-17.066667-6.4z m138.666667 853.333333h-277.333333c-36.266667 0-66.133333-29.866667-66.133334-66.133333v-277.333334c0-36.266667 29.866667-66.133333 66.133334-66.133333h277.333333c36.266667 0 66.133333 29.866667 66.133333 66.133333v277.333334c2.133333 36.266667-27.733333 66.133333-66.133333 66.133333zM614.4 590.933333c-12.8 0-25.6 10.666667-25.6 25.6v277.333334c0 12.8 10.666667 25.6 25.6 25.6h277.333333c12.8 0 25.6-10.666667 25.6-25.6v-277.333334c0-12.8-10.666667-25.6-25.6-25.6h-277.333333z" fill="#1E87EB" p-id="9446"></path></svg>
                        <span style="font-size: 16px;font-weight: bold;vertical-align: bottom;margin-left: 4px;">商品金额信息</span>
                    </div>
                    <el-table size="mini" :data="summary" style="width: 100%" border>
                        <el-table-column prop="num" label="数量汇总" align="center"></el-table-column>
                        <el-table-column prop="price" label="原价金额汇总" align="center"></el-table-column>
                        <el-table-column label="折扣" align="center">
                            <template> {{ this.discount }} 折</template>
                        </el-table-column>
                        <el-table-column prop="discount_price" label="折后金额汇总" align="center"></el-table-column>
                    </el-table>
                    <div style="margin-top: 10px"><span style="color: red">*</span>付款信息（ 只允许上传一张图片 ）</div>
                    <el-upload action="/api/tool/fileImport" list-type="picture-card"
                               :headers="uploadHeaders"
                               :data="uploadData"
                               :file-list="ipurchaseImg"
                               :on-success="(res, file, fileList)=>uploadSuccessHandle( res, file, fileList)"
                               :before-upload="beforeUploadHandle">
                        <i slot="default" class="el-icon-plus"></i>
                        <div slot="file" slot-scope="{file}">
                            <img class="el-upload-list__item-thumbnail" :src="file.url"/>
                            <span class="el-upload-list__item-actions">
                        <span class="el-upload-list__item-preview" @click="previewImgBtn(file)">
                          <i class="el-icon-zoom-in"></i>
                        </span>
                        <span class="el-upload-list__item-delete" @click="delImgBtn(file)">
                          <i class="el-icon-delete"></i>
                        </span>
                    </span>
                        </div>
                    </el-upload>
                </el-col>
            </el-row>
            <div slot="footer">
                <el-button v-if="step==1" @click="ipurchaseLendVisible=false" size="small" plain>退 出</el-button>
                <el-button v-if="step==1" @click="stepBtn" size="small" type="primary" plain>下一步</el-button>
                <el-button v-if="step==2" @click="step=1" size="small" type="primary" plain>上一步</el-button>
                <el-button v-if="step==2" :disabled="!ipurchaseImg.length" type="primary" @click="ipurchaseSubmitBtn" size="small" :loading="saveLoading">确 定</el-button>
            </div>
        </el-dialog>

        <!--未归还转赠送-->
        <el-dialog title="未归还转赠送" :visible.sync="giveLendVisible" :close-on-click-modal="false" :close-on-press-escape="false" top="2%" width="1000px">
            <el-row>
                <el-table :data="selectedData" style="width: 100%" max-height="350px" v-loading="loading" size="mini">
                    <el-table-column prop="img" label="图片" width="50">
                        <template slot-scope="{row}">
                            <el-image :src="row.img" fit="contian" :preview-src-list="[row.img]">
                                <div slot="error" class="image-slot">
                                    <svg t="1718681716906" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2623" width="20" height="20"><path d="M400.696 268.795c-17.249 0-31.233 13.986-31.233 31.233v30.471c0 17.249 13.986 31.233 31.233 31.233s31.233-13.986 31.233-31.233v-30.471c0-17.249-13.985-31.233-31.233-31.233z" fill="#999999" p-id="2624"></path><path d="M623.649 361.734c17.249 0 31.234-13.986 31.234-31.233v-30.471c0-17.249-13.986-31.233-31.234-31.233s-31.233 13.986-31.233 31.233v30.471c-0.001 17.248 13.985 31.233 31.233 31.233z" fill="#999999" p-id="2625"></path><path d="M438.295 388.804c-14.656 9.104-19.155 28.362-10.050 43.013 11.209 18.047 41.976 48.59 86.157 48.59 43.958 0 75.1-30.313 86.574-48.223 9.303-14.529 5.068-33.847-9.455-43.15-14.539-9.298-33.852-5.068-43.15 9.455-0.122 0.199-13.38 19.45-33.969 19.45-20.009 0-32.444-18.128-33.278-19.373-9.166-14.423-28.28-18.805-42.829-9.761z" fill="#999999" p-id="2626"></path><path d="M824.508503 116.690676 571.592236 116.690676c-17.248849 0-31.233352 13.985526-31.233352 31.233352s13.985526 31.233352 31.233352 31.233352l252.916267 0c40.181141 0 72.878844 32.692586 72.878844 72.878844l0 396.966057-189.334159-165.29465c-12.20088-10.655687-30.517037-10.207479-42.173518 0.9967L468.578048 674.16231 309.521472 517.519714c-11.895935-11.70253-30.903847-12.002358-43.154869-0.645706L126.957507 646.163629l0-394.126382c0-40.186258 32.692586-72.878844 72.878844-72.878844l252.916267 0c17.248849 0 31.233352-13.985526 31.233352-31.233352S470.000444 116.690676 452.751594 116.690676L199.836351 116.690676c-74.632791 0-135.346571 60.71378-135.346571 135.346571l0 520.56405c0 74.632791 60.71378 135.346571 135.346571 135.346571l252.916267 0c17.248849 0 31.233352-13.985526 31.233352-31.233352s-13.985526-31.233352-31.233352-31.233352L199.836351 845.481164c-40.186258 0-72.878844-32.692586-72.878844-72.878844l0-41.23924 160.003134-148.385539 159.428036 157.007917c12.048407 11.865235 31.361265 11.981892 43.546795 0.274246l198.576661-190.68697 208.876238 182.346001 0 40.683585c0 40.186258-32.697703 72.878844-72.878844 72.878844L571.592236 845.481164c-17.248849 0-31.233352 13.985526-31.233352 31.233352s13.985526 31.233352 31.233352 31.233352l252.916267 0c74.627674 0 135.346571-60.71378 135.346571-135.346571L959.855074 252.037247C959.855074 177.404456 899.136178 116.690676 824.508503 116.690676z" fill="#999999" p-id="2627"></path></svg>
                                </div>
                            </el-image>
                        </template>
                    </el-table-column>
                    <el-table-column prop="type_name" label="款名" show-overflow-tooltip></el-table-column>
                    <el-table-column prop="sku_code" label="规格编码" width="140"></el-table-column>
                    <el-table-column prop="num" label="计划借出/实际借出数量" width="150">
                        <template slot-scope="{row}">
                            <span style="font-size: 16px;font-weight: bold">{{row.num}}</span> /
                            <span style="font-size: 16px;font-weight: bold;color: #ed4014">{{row.actually_num}}</span>
                        </template>
                    </el-table-column>
                    <el-table-column prop="actually_return_num" label="已归还数">
                        <template slot-scope="{row}">
                            <span style="font-size: 16px;font-weight: bold" :style="{color: row.actually_return_num==0?'#dcdee2':''}">{{row.actually_return_num}}</span>
                        </template>
                    </el-table-column>
                    <el-table-column prop="ipurchase_num" label="已转内购数">
                        <template slot-scope="{row}">
                            <span style="font-size: 16px;font-weight: bold" :style="{color: row.ipurchase_num==0?'#dcdee2':''}">{{row.ipurchase_num}}</span>
                        </template>
                    </el-table-column>
                    <el-table-column prop="give_num" label="已转赠送数">
                        <template slot-scope="{row}">
                            <span style="font-size: 16px;font-weight: bold" :style="{color: row.give_num==0?'#dcdee2':''}">{{row.give_num}}</span>
                        </template>
                    </el-table-column>
                    <el-table-column prop="sale_num" label="已转销售数">
                        <template slot-scope="{row}">
                            <span style="font-size: 16px;font-weight: bold" :style="{color: row.sale_num==0?'#dcdee2':''}">{{row.sale_num}}</span>
                        </template>
                    </el-table-column>
                    <el-table-column prop="plan_give_num" label="计划赠送数量">
                        <template slot-scope="{row}">
                            <el-input size="mini" v-model="row.plan_give_num" type="number" placeholder="赠送数量"></el-input>
                        </template>
                    </el-table-column>
                </el-table>
            </el-row>
            <div slot="footer">
                <el-button @click="giveLendVisible=false" size="small" plain>退 出</el-button>
                <el-button type="primary" @click="giveLendSubmitBtn" size="small" :loading="saveLoading">确 定</el-button>
            </div>
        </el-dialog>

        <!--赠送转归还-->
        <el-dialog title="赠送转归还" :visible.sync="returnGiveVisible" :close-on-click-modal="false" :close-on-press-escape="false" top="2%" width="1000px">
            <el-row>
                <el-table :data="selectedData" style="width: 100%" max-height="350px" v-loading="loading" size="mini">
                    <el-table-column prop="img" label="图片" width="50">
                        <template slot-scope="{row}">
                            <el-image :src="row.img" fit="contian" :preview-src-list="[row.img]">
                                <div slot="error" class="image-slot">
                                    <svg t="1718681716906" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2623" width="20" height="20"><path d="M400.696 268.795c-17.249 0-31.233 13.986-31.233 31.233v30.471c0 17.249 13.986 31.233 31.233 31.233s31.233-13.986 31.233-31.233v-30.471c0-17.249-13.985-31.233-31.233-31.233z" fill="#999999" p-id="2624"></path><path d="M623.649 361.734c17.249 0 31.234-13.986 31.234-31.233v-30.471c0-17.249-13.986-31.233-31.234-31.233s-31.233 13.986-31.233 31.233v30.471c-0.001 17.248 13.985 31.233 31.233 31.233z" fill="#999999" p-id="2625"></path><path d="M438.295 388.804c-14.656 9.104-19.155 28.362-10.050 43.013 11.209 18.047 41.976 48.59 86.157 48.59 43.958 0 75.1-30.313 86.574-48.223 9.303-14.529 5.068-33.847-9.455-43.15-14.539-9.298-33.852-5.068-43.15 9.455-0.122 0.199-13.38 19.45-33.969 19.45-20.009 0-32.444-18.128-33.278-19.373-9.166-14.423-28.28-18.805-42.829-9.761z" fill="#999999" p-id="2626"></path><path d="M824.508503 116.690676 571.592236 116.690676c-17.248849 0-31.233352 13.985526-31.233352 31.233352s13.985526 31.233352 31.233352 31.233352l252.916267 0c40.181141 0 72.878844 32.692586 72.878844 72.878844l0 396.966057-189.334159-165.29465c-12.20088-10.655687-30.517037-10.207479-42.173518 0.9967L468.578048 674.16231 309.521472 517.519714c-11.895935-11.70253-30.903847-12.002358-43.154869-0.645706L126.957507 646.163629l0-394.126382c0-40.186258 32.692586-72.878844 72.878844-72.878844l252.916267 0c17.248849 0 31.233352-13.985526 31.233352-31.233352S470.000444 116.690676 452.751594 116.690676L199.836351 116.690676c-74.632791 0-135.346571 60.71378-135.346571 135.346571l0 520.56405c0 74.632791 60.71378 135.346571 135.346571 135.346571l252.916267 0c17.248849 0 31.233352-13.985526 31.233352-31.233352s-13.985526-31.233352-31.233352-31.233352L199.836351 845.481164c-40.186258 0-72.878844-32.692586-72.878844-72.878844l0-41.23924 160.003134-148.385539 159.428036 157.007917c12.048407 11.865235 31.361265 11.981892 43.546795 0.274246l198.576661-190.68697 208.876238 182.346001 0 40.683585c0 40.186258-32.697703 72.878844-72.878844 72.878844L571.592236 845.481164c-17.248849 0-31.233352 13.985526-31.233352 31.233352s13.985526 31.233352 31.233352 31.233352l252.916267 0c74.627674 0 135.346571-60.71378 135.346571-135.346571L959.855074 252.037247C959.855074 177.404456 899.136178 116.690676 824.508503 116.690676z" fill="#999999" p-id="2627"></path></svg>
                                </div>
                            </el-image>
                        </template>
                    </el-table-column>
                    <el-table-column prop="type_name" label="款名" show-overflow-tooltip></el-table-column>
                    <el-table-column prop="sku_code" label="规格编码" width="140"></el-table-column>
                    <el-table-column prop="num" label="计划赠送/实际赠送数量" width="150">
                        <template slot-scope="{row}">
                            <span style="font-size: 16px;font-weight: bold">{{row.num}}</span> /
                            <span style="font-size: 16px;font-weight: bold;color: #ed4014">{{row.actually_num}}</span>
                        </template>
                    </el-table-column>
                    <el-table-column prop="actually_return_num" label="已归还数">
                        <template slot-scope="{row}">
                            <span style="font-size: 16px;font-weight: bold" :style="{color: row.actually_return_num==0?'#dcdee2':''}">{{row.actually_return_num}}</span>
                        </template>
                    </el-table-column>
                    <el-table-column prop="plan_return_num" label="计划归还数量">
                        <template slot-scope="{row}">
                            <el-input size="mini" v-model="row.plan_return_num" type="number" placeholder="归还数量"></el-input>
                        </template>
                    </el-table-column>
                </el-table>
                <div style="margin-top: 10px">
                    <svg t="1717659283335" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9445" width="16" height="16"><path d="M407.466667 477.866667h-277.333334C93.866667 477.866667 64 448 64 409.6v-277.333333c0-36.266667 29.866667-66.133333 66.133333-66.133334h277.333334c36.266667 0 66.133333 29.866667 66.133333 66.133334v277.333333c2.133333 38.4-27.733333 68.266667-66.133333 68.266667zM132.266667 108.8c-12.8 0-25.6 10.666667-25.6 25.6v277.333333c0 12.8 10.666667 25.6 25.6 25.6h277.333333c12.8 0 25.6-10.666667 25.6-25.6v-277.333333c0-12.8-10.666667-25.6-25.6-25.6h-277.333333zM407.466667 960h-277.333334C93.866667 960 64 930.133333 64 893.866667v-277.333334c0-36.266667 29.866667-66.133333 66.133333-66.133333h277.333334c36.266667 0 66.133333 29.866667 66.133333 66.133333v277.333334c2.133333 36.266667-27.733333 66.133333-66.133333 66.133333zM132.266667 590.933333c-12.8 0-25.6 10.666667-25.6 25.6v277.333334c0 12.8 10.666667 25.6 25.6 25.6h277.333333c12.8 0 25.6-10.666667 25.6-25.6v-277.333334c0-12.8-10.666667-25.6-25.6-25.6h-277.333333z m618.666666-110.933333c-17.066667 0-34.133333-6.4-46.933333-19.2L563.2 320c-12.8-12.8-19.2-29.866667-19.2-46.933333s6.4-34.133333 19.2-46.933334L704 83.2c12.8-12.8 29.866667-19.2 46.933333-19.2 17.066667 0 34.133333 6.4 46.933334 19.2l140.8 140.8c12.8 12.8 19.2 29.866667 19.2 46.933333 0 17.066667-6.4 34.133333-19.2 46.933334l-138.666667 142.933333c-12.8 12.8-29.866667 19.2-49.066667 19.2z m0-373.333333c-6.4 0-12.8 2.133333-17.066666 6.4l-140.8 140.8c-4.266667 4.266667-6.4 10.666667-6.4 17.066666 0 6.4 2.133333 12.8 6.4 17.066667l140.8 140.8c4.266667 4.266667 10.666667 6.4 17.066666 6.4 6.4 0 12.8-2.133333 17.066667-6.4l140.8-140.8c4.266667-4.266667 6.4-10.666667 6.4-17.066667 0-6.4-2.133333-12.8-6.4-17.066666L768 113.066667c-4.266667-4.266667-8.533333-6.4-17.066667-6.4z m138.666667 853.333333h-277.333333c-36.266667 0-66.133333-29.866667-66.133334-66.133333v-277.333334c0-36.266667 29.866667-66.133333 66.133334-66.133333h277.333333c36.266667 0 66.133333 29.866667 66.133333 66.133333v277.333334c2.133333 36.266667-27.733333 66.133333-66.133333 66.133333zM614.4 590.933333c-12.8 0-25.6 10.666667-25.6 25.6v277.333334c0 12.8 10.666667 25.6 25.6 25.6h277.333333c12.8 0 25.6-10.666667 25.6-25.6v-277.333334c0-12.8-10.666667-25.6-25.6-25.6h-277.333333z" fill="#1E87EB" p-id="9446"></path></svg>
                    <span style="font-size: 16px;font-weight: bold;vertical-align: bottom;margin-left: 4px;">邮寄信息</span>
                </div>
                <el-form :model="returnForm" :rules="rules" inline label-width="100px">
                    <el-form-item label="快递单号" prop="ourier_number">
                        <el-input size="small" v-model.trim="returnForm.ourier_number" clearable></el-input>
                    </el-form-item>
                    <el-form-item label="运输方式" prop="logistics_code">
                        <el-select size="small" v-model="returnForm.logistics_code">
                            <el-option v-for="(item, index) in logistics.list" :key="index" :label="item.name" :value="item.code"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="联系人" prop="wp_user">
                        <el-input size="small" v-model.trim="returnForm.wp_user" clearable></el-input>
                    </el-form-item>
                    <el-form-item label="联系电话" prop="wp_phone">
                        <el-input size="small" v-model.trim="returnForm.wp_phone" clearable></el-input>
                    </el-form-item>
                    <el-form-item label="邮寄地址" prop="wp_address">
                        <el-input size="small" v-model.trim="returnForm.wp_address" style="width: 540px;" clearable></el-input>
                    </el-form-item>
                    <el-form-item label="备注">
                        <el-input size="small" type="textarea" style="width: 540px;" v-model.trim="returnForm.remark" clearable></el-input>
                    </el-form-item>
                </el-form>
            </el-row>
            <div slot="footer">
                <el-button @click="returnGiveVisible=false" size="small" plain>退 出</el-button>
                <el-button type="primary" @click="returnGiveSubmitBtn" size="small" :loading="saveLoading" :disabled="!returnForm.ourier_number">确 定</el-button>
            </div>
        </el-dialog>

        <!--图片预览-->
        <el-dialog :visible.sync="previewVisible">
            <img width="100%" :src="previewUrl" alt="">
        </el-dialog>

        <!--审核进度-->
        <el-drawer title="调拨审批进度" :visible.sync="approvalVisible" size="650px" direction="rtl" :wrapperClosable="false" :before-close="closeBtn">
            <process-allocation v-if="approvalVisible" :runId="runId" :id="lendId"></process-allocation>
        </el-drawer>
    </section>
</template>

<script>
import {
    lendCancel,
    lendDetail, lendGiveLend, lendIpurchase,
    lendLogistics,
    lendMyList, lendReturnGive,
    lendReturnOnly,
    lendStatistic
} from "@/api/op/lend";
import {getToken} from "@/libs/util";
import myLendGive from "@/view/op/components/myLendGive";
import processAllocation from "@/view/components/flow/processAllocation";

export default {
    name: "op_lend",
    components:{myLendGive, processAllocation},
    data() {
        return {
            tableHeight: window.innerHeight - 240,
            selectIndex: 0,
            btnLoading: false,
            saveLoading: false,
            loading: false,
            page: 1,
            limit: 20,
            total: 0,
            data: [],
            user: {},
            nodeActions: [],

            form:{allocation_number: "", groups: [], status: [],data_return: [],is_push: "",reason:"",wp_address:"",wp_phone:"",wp_user:"",createtime:"",is_subject:"",
                sku_code:"",data_status:"",from_adduser:""},

            tab: 'all',
            logistics: {list: []},
            detail: {},
            detailJList: [],
            detailHList: [],
            detailZList: [],
            detailXList: [],
            detailZNGList: [],
            detailJZSList: [],
            detailJZXList: [],
            drawerTableHeight: window.innerHeight - 300+"px",
            drawerTableHeight2: window.innerHeight - 330+"px",
            detailJVisible: false,
            detailZVisible: false,
            detailHVisible: false,
            detailXVisible: false,

            unReturnNum: 0,
            lendNum: 0,
            returnNum: 0,
            giveNum: 0,

            selectedData: [],

            rules: {
                ourier_number: [
                    { required: true,trigger: 'blur'},
                ],
                logistics_code: [
                    { required: true,trigger: 'blur'}
                ],
                wp_user: [
                    { required: true,trigger: 'blur'}
                ],
                wp_phone: [
                    { required: true,trigger: 'blur'}
                ],
                wp_address: [
                    { required: true,trigger: 'blur'}
                ],
            },
            returnVisible: false,//归还所选
            returnXVisible: false,//销售退货
            returnGiveVisible: false,//赠送转归还
            giveLendVisible: false,//借出转赠送
            ipurchaseLendVisible: false,//借出转内购
            step: 1,
            discount: 6.8,//商品折扣
            summary: [],
            returnForm: {
                ourier_number: "",
                logistics_code: "YTO-D",
                wp_user: "",
                wp_phone: "",
                wp_address: "",
                remark: "",
                reason: "归还所借商品",
                detail: []
            },

            ipurchaseImg:[],
            uploadHeaders: {},
            uploadData:{type: 'lend_ipurchase', disk: 'image'},
            previewVisible: false,
            previewUrl: "",

            lendVisible: false,//我要借出
            giveVisible: false,//我要赠送
            saleVisible: false,//我要销售

            //审批流程
            approvalVisible: false,
            runId: "",
            lendId: "",
        }
    },
    created() {
        this.user = this.$store.getters.user;
        this.nodeActions = this.user.node_actions[this.$route.meta.id] ? this.user.node_actions[this.$route.meta.id] : [];
    },
    methods: {
        //来源单号 跳转
        searchAllocationBtn(sourceNumbers, allocationNumber){
            if(typeof(sourceNumbers) == "string"){
                this.form.allocation_number = allocationNumber+","+sourceNumbers;
            }else{
                this.form.allocation_number = sourceNumbers.join(",")+","+allocationNumber;
            }
            this.searchBtn();
        },
        //搜索按钮
        searchBtn() {
            this.page = 1;
            this.getData();
        },
        //翻页
        pageChange(page) {
            this.page = page;
            this.getData();
        },
        //获取数据
        getData() {
            let param = {
                page: this.page,
                limit: this.limit
            };
            param = Object.assign(this.form, param);
            this.loading = true;
            lendMyList(param).then((res) => {
                this.loading = false;
                this.total = res.data.total;
                this.data = res.data.data;
            }).catch(() => {
                this.loading = false;
            });
        },
        //行色 计划关闭
        rowClassName({row, index}){
            if(row.data_status == 1){
                return "row-closed-data";
            }
        },
        //取消调拨
        cancelBtn(allocation_number){
            this.$confirm("确定取消调拨?", "提示", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            }).then(() => {
                this.loading = true;
                lendCancel({allocation_number: allocation_number}).then((res) =>{
                    this.loading = false;
                    if(res.code === 0){
                        this.$message.success("调拨计划: 取消成功");
                        this.getData();
                    }else{
                        this.$message.error(res.msg);
                    }
                }).catch(()=>{
                    this.loading = false;
                })
            }).catch(() => {

            });
        },
        //物流
        getLogistics(){
            lendLogistics().then((res) =>{
                this.logistics = res.data;
            })
        },
        //详情
        detailBtn(row){
            let groups = row.groups;
            let allocationNumber = row.allocation_number;
            this.detail = JSON.parse(JSON.stringify(row));
            switch (groups){
                case 1://赠送
                    this.loading = true;
                    lendDetail({groups: groups, allocation_number: allocationNumber}).then((res) =>{
                        this.loading = false;
                        this.detailZList = res.data.give_list;
                        this.detailHList = res.data.return_list;
                        this.detailZVisible = true;
                    }).catch(()=>{
                        this.loading = false;
                    })
                    break;
                case 2://借出
                    this.loading = true;
                    lendDetail({groups: groups, allocation_number: allocationNumber}).then((res) =>{
                        this.loading = false;
                        this.detailJList = res.data.lend_list;
                        this.detailHList = res.data.return_list;
                        this.detailZNGList = res.data.ipurchase_list;
                        this.detailJZSList = res.data.give_list;
                        this.detailJZXList = res.data.sale_list;
                        this.detailJVisible = true;
                    }).catch(()=>{
                        this.loading = false;
                    })
                    break;
                case 3://归还
                    this.loading = true;
                    lendDetail({groups: groups, allocation_number: allocationNumber}).then((res) =>{
                        this.loading = false;
                        this.detailHList = res.data.return_list;
                        this.detailHVisible = true;
                    }).catch(()=>{
                        this.loading = false;
                    })
                    break;
                case 4://销售
                    this.loading = true;
                    lendDetail({groups: groups, allocation_number: allocationNumber}).then((res) =>{
                        this.loading = false;
                        this.detailXList = res.data.lend_list;
                        this.detailHList = res.data.return_list;
                        let planAmount = 0;
                        let actuallyAmount = 0;
                        this.detailXList.forEach(item => {
                            planAmount += Number(item.num) * Number(item.price);
                            actuallyAmount += (Number(item.actually_num) - Number(item.actually_return_num)) * Number(item.price);
                        });
                        this.detail.plan_amount = parseFloat(planAmount.toFixed(10));
                        this.detail.actually_amount = parseFloat(actuallyAmount.toFixed(10));
                        this.detailXVisible = true;
                    }).catch(()=>{
                        this.loading = false;
                    })
                    break;

            }
        },
        //获取详情列表
        getDetailList(allocationNumber, groups){

        },
        processBtn(row){
            //审批流程
            this.approvalVisible = true;
            this.runId = row.approval_id;
            this.lendId = row.id;
        },
        closeBtn(){
            this.tab = "all";
            this.detail = {};
            this.selectedData = [];
            this.detailJList = [];
            this.detailHList = [];
            this.detailZList = [];
            this.detailXList = [];
            this.detailZNGList = [];
            this.detailJZSList = [];
            this.detailJZXList = [];
            this.detailJVisible = false;
            this.detailZVisible = false;
            this.detailHVisible = false;
            this.detailXVisible = false;
            this.approvalVisible = false;
            this.lendVisible = false;
            this.giveVisible = false;
            this.saleVisible = false;
            this.returnVisible = false;
            this.returnXVisible = false;
            this.returnGiveVisible = false;
            this.giveLendVisible = false;
            this.ipurchaseLendVisible = false;
        },
        statistic(){
            lendStatistic().then((res) =>{
                this.lendNum = res.data.lend_num;
                this.returnNum = res.data.return_num;
                this.giveNum = res.data.give_num;
                this.unReturnNum = res.data.un_return_num;
                if(this.unReturnNum > 0){
                    this.$notify({
                        title: '提醒注意',
                        type: 'warning',
                        dangerouslyUseHTMLString: true,
                        duration: 5000,
                        message: '<strong>您还有&nbsp;<span style="font-size: 13px;font-weight: bold;color:#f56c6c">'+
                            this.unReturnNum+'</span>&nbsp;条借出单据未归还, 请及时处理</strong>'
                    });
                }
            })
        },
        selectedTableBtn(val){
            this.selectedData = val;
        },
        selectable(row, index){
            if(this.detail.data_status == 1){
                return false;
            }
            if(row.is_return == 2){
                return false;
            }
            if(this.detail.groups == 2){
                if(row.actually_num <= (row.actually_return_num + row.ipurchase_num + row.sale_num + row.give_num)){
                    return false;
                }
            }
            if(this.detail.groups == 1){
                if(row.actually_num <= row.actually_return_num){
                    return false;
                }
            }

            return true;
        },
        //归还所选
        openReturnBtn(){
            let list = JSON.parse(JSON.stringify(this.selectedData));
            this.selectedData = [];
            list.forEach(item =>{
                item.plan_return_num = 1;
                this.selectedData.push(item);
            });
            this.returnVisible=true;
            this.returnForm = {
                ourier_number: "",
                is_subject: this.detail.is_subject,
                logistics_code: "YTO-D",
                wp_user: this.logistics.part_A_receive,
                wp_phone: this.logistics.part_A_receive_tel,
                wp_address: this.logistics.part_A_place,
                remark: "",
                reason: "所借商品归还",
                detail: []
            };
        },
        //销售退货
        openXReturnBtn(){
            let list = JSON.parse(JSON.stringify(this.selectedData));
            this.selectedData = [];
            list.forEach(item =>{
                item.plan_return_num = 1;
                this.selectedData.push(item);
            });
            this.returnXVisible=true;
            this.returnForm = {
                ourier_number: "",
                is_subject: this.detail.is_subject,
                logistics_code: "YTO-D",
                wp_user: this.logistics.part_A_receive,
                wp_phone: this.logistics.part_A_receive_tel,
                wp_address: this.logistics.part_A_place,
                remark: "",
                reason: "销售商品归还",
                detail: []
            };
        },
        //未归还转赠送
        openGiveBtn(){
            let list = JSON.parse(JSON.stringify(this.selectedData));
            this.selectedData = [];
            list.forEach(item =>{
                item.plan_give_num = 1;
                this.selectedData.push(item);
            });
            this.giveLendVisible=true;
        },
        //赠送转归还
        openReturnGiveBtn(){
            let list = JSON.parse(JSON.stringify(this.selectedData));
            this.selectedData = [];
            list.forEach(item =>{
                item.plan_return_num = 1;
                this.selectedData.push(item);
            });
            this.returnGiveVisible=true;
            this.returnForm = {
                ourier_number: "",
                is_subject: this.detail.is_subject,
                logistics_code: "YTO-D",
                wp_user: this.logistics.part_A_receive,
                wp_phone: this.logistics.part_A_receive_tel,
                wp_address: this.logistics.part_A_place,
                remark: "",
                reason: "归还所赠商品",
                detail: []
            };
        },
        openIpurchaseBtn(){
            let list = JSON.parse(JSON.stringify(this.selectedData));
            this.selectedData = [];
            list.forEach(item =>{
                item.plan_buy_num = 1;
                item.actually_buy_num = item.actually_num - item.actually_return_num - item.ipurchase_num - item.sale_num - item.give_num;
                item.price = "";
                this.selectedData.push(item);
            });
            this.ipurchaseLendVisible=true;
            this.step=1;
            this.ipurchaseImg = [];
        },
        //确认归还所选
        returnSubmitBtn(){
            if(!this.returnForm.ourier_number || !this.returnForm.wp_address || !this.returnForm.wp_phone || !this.returnForm.wp_user){
                this.$message.warning("必填项不能为空");return;
            }
            let overNumSku = [];
            let emptyNumSku = [];
            this.returnForm.detail = [];
            this.selectedData.forEach(item =>{
                if((item.actually_return_num + item.ipurchase_num + item.sale_num + item.give_num + Number(item.plan_return_num)) > item.actually_num){
                    overNumSku.push(item.sku_code);
                }
                if(!item.plan_return_num || item.plan_return_num<=0){
                    emptyNumSku.push(item.sku_code);
                }
                this.returnForm.detail.push({allocation_number: item.allocation_number, sku_code: item.sku_code, num: item.plan_return_num, price: item.price});
            });
            if(emptyNumSku.length>0){
                this.$message.warning("计划归还数未填写: "+emptyNumSku.join(", "));return;
            }
            if(overNumSku.length>0){
                this.$message.warning("计划归还数超标: "+overNumSku.join(", "));return;
            }
            this.saveLoading = true;
            lendReturnOnly(this.returnForm).then((res) =>{
                this.saveLoading = false;
                if(res.code === 0){
                    this.$message.success("已提交归还任务，请耐心等待飞书审批!!!");
                    this.closeBtn();
                    this.getData();
                } else{
                    this.$message.error(res.msg);
                }
            }).catch(()=>{
                this.saveLoading = false;
            })
        },
        //确认赠送转归还
        returnGiveSubmitBtn(){
            if(!this.returnForm.ourier_number || !this.returnForm.wp_address || !this.returnForm.wp_phone || !this.returnForm.wp_user){
                this.$message.warning("必填项不能为空");return;
            }
            let overNumSku = [];
            let emptyNumSku = [];
            this.returnForm.detail = [];
            this.selectedData.forEach(item =>{
                if((item.actually_return_num + Number(item.plan_return_num)) > item.actually_num){
                    overNumSku.push(item.sku_code);
                }
                if(!item.plan_return_num || item.plan_return_num<=0){
                    emptyNumSku.push(item.sku_code);
                }
                this.returnForm.detail.push({allocation_number: item.allocation_number, sku_code: item.sku_code, num: item.plan_return_num});
            });
            if(emptyNumSku.length>0){
                this.$message.warning("计划归还数未填写: "+emptyNumSku.join(", "));return;
            }
            if(overNumSku.length>0){
                this.$message.warning("计划归还数超标: "+overNumSku.join(", "));return;
            }
            this.saveLoading = true;
            lendReturnGive(this.returnForm).then((res) =>{
                this.saveLoading = false;
                if(res.code === 0){
                    this.$message.success("已提交归还任务，请耐心等待飞书审批!!!");
                    this.closeBtn();
                    this.getData();
                } else{
                    this.$message.error(res.msg);
                }
            }).catch(()=>{
                this.saveLoading = false;
            })
        },
        //确认借出转赠送
        giveLendSubmitBtn(){
            let overNumSku = [];
            let emptyNumSku = [];
            let obj = {
                allocation_number: this.detail.allocation_number,
                is_subject: this.detail.is_subject,
                detail: [],
                reason: "未归还转赠送",
            };
            this.selectedData.forEach(item =>{
                if((item.actually_return_num + item.ipurchase_num + item.sale_num + item.give_num + Number(item.plan_give_num)) > item.actually_num){
                    overNumSku.push(item.sku_code);
                }
                if(!item.plan_give_num || item.plan_give_num<=0){
                    emptyNumSku.push(item.sku_code);
                }
                obj.detail.push({sku_code: item.sku_code, num: item.plan_give_num});
            });
            if(emptyNumSku.length>0){
                this.$message.warning("计划赠送数未填写: "+emptyNumSku.join(", "));return;
            }
            if(overNumSku.length>0){
                this.$message.warning("计划赠送数超标: "+overNumSku.join(", "));return;
            }
            this.saveLoading = true;
            lendGiveLend(obj).then((res) =>{
                this.saveLoading = false;
                if(res.code === 0){
                    this.$message.success("已提交赠送任务，请耐心等待飞书审批!!!");
                    this.closeBtn();
                    this.getData();
                } else{
                    this.$message.error(res.msg);
                }
            }).catch(()=>{
                this.saveLoading = false;
            })
        },
        //下一步
        stepBtn(){
            let overNumSku = [];
            let emptyNumSku = [];
            this.summary = [{num: 0, price: 0, discount: this.discount, discount_price: 0}];
            this.selectedData.forEach(item =>{
                if(item.actually_buy_num < item.plan_buy_num){
                    overNumSku.push(item.sku_code);
                }
                if(!item.plan_buy_num || item.plan_buy_num<=0 || !item.price || item.price <= 0){
                    emptyNumSku.push(item.sku_code);
                }
                this.summary[0].num += Number(item.plan_buy_num);
                this.summary[0].price += Number(item.price);
            });
            this.summary[0].discount_price = (this.summary[0].price * Number(this.discount)/10).toFixed(2);
            if(overNumSku.length>0){
                this.$message.warning("计划内购数超标: "+overNumSku.join(", "));return;
            }
            if(emptyNumSku.length>0){
                this.$message.warning("计划内购数或单价不能为空: "+emptyNumSku.join(", "));return;
            }
            if(!this.discount || this.discount<=0){
                this.$message.warning("请输入商品折扣");return;
            }
            this.step = 2;
        },
        //确认借出转内购
        ipurchaseSubmitBtn(){
            let obj = {
                allocation_number: this.detail.allocation_number,
                is_subject: this.detail.is_subject,
                detail: [],
                discount: this.discount,
                img: this.ipurchaseImg[0].response.data,
            };
            this.selectedData.forEach(item =>{
                obj.detail.push({sku_code:item.sku_code, num: item.plan_buy_num, price: item.price});
            });
            this.saveLoading = true;
            lendIpurchase(obj).then((res) =>{
                this.saveLoading = false;
                if(res.code === 0){
                    this.$message.success("已提交内购任务，请耐心等待飞书审批!!!");
                    this.closeBtn();
                    this.getData();
                } else{
                    this.$message.error(res.msg);
                }
            }).catch(() =>{
                this.saveLoading = false;
            })
        },


        //上传之前的检测
        beforeUploadHandle(file) {
            if(!['image/jpg','image/jpeg','image/png'].includes(file.type)){
                this.$message.error('上传图片只能是 jpg、png 格式!');
                return false;
            }
            this.uploadHeaders.Authorization = 'Bearer '+ getToken();
            return true;
        },
        //上传成功
        uploadSuccessHandle(res, file, fileList) {
            if(res.code === 0){
                this.ipurchaseImg = [ fileList[fileList.length-1] ];
                this.$message.success("上传成功");
            }else{
                this.$message.error("上传失败");
                fileList = fileList.filter(item => item.response && item.response.code === 0);
                this.ipurchaseImg = fileList;
            }
        },
        //预览
        previewImgBtn(file){
            this.previewUrl = file.url;
            this.previewVisible = true;
        },
        //删除图片
        delImgBtn(file){
            this.ipurchaseImg.splice(0, 1);
        },
    },
    mounted() {
        this.getLogistics();
        this.statistic();
        this.searchBtn();
    }
}
</script>

<style scoped>
.el-table /deep/ .row-closed-data{
    background-color: #30313375;
}
/deep/ .el-table__expanded-cell{
    margin: 0;padding: 0 0 0 40px;
}
.demo-table-expand /deep/ label {
    width: 80px;
    color: #99a9bf;
    font-size: 12px;
}
.demo-table-expand /deep/ div {
    font-size: 12px;
    color: #99a9bf;
}
.demo-table-expand /deep/ .el-form-item {
    margin-right: 0;
    margin-bottom: 0;
    width: 60%;
}
.el-image /deep/ .el-icon-circle-close:before{
    color: white;
}

.more-btn /deep/ .el-badge__content.is-fixed.is-dot{
    top: 5px;
}

/*我要销售*/
.el-button--sale.is-plain{
    background-color: #ecd3f9;
    border-color: #dfb7f3;
    color: #b424ef;
}
.el-button--sale.is-plain:hover{
    background-color: #b424ef;
    border-color: #b424ef;
    color: #fff;
}
.el-tag.el-tag--sale {
    background-color: #ecd3f9;
    border-color: #dfb7f3;
    color: #b424ef;
}
</style>
